• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Write a file in utf8
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Write a file in utf8


  • Subject: Re: Write a file in utf8
  • From: Yvan KOENIG <email@hidden>
  • Date: Wed, 5 Aug 2009 14:57:19 +0200

With this version, it behaves flawlessly.

set FileLocation to "Macintosh HD:Users:yvan_koenig:Desktop:essai.txt"

set FileContent to "spécification. Kœnig"
my WriteToFile(FileContent, FileLocation)
on WriteToFile(FileContent, FileLocation)
set the_file to FileLocation as file specification
try
open for access the_file with write permission
set eof of the_file to 0
write (ASCII character 254) & (ASCII character 255) to the_file starting at 1
write (FileContent as «class utf8») to the_file starting at 3
close access the_file
on error
try
close access the_file
end try
end try

return the_file as alias
end WriteToFile


CAUTION, the pathname is specific to my machine !

Yvan KOENIG (from FRANCE mercredi 5 août 2009 14:56:31)



_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Write a file in utf8
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Write a file in utf8 (From: Jay Louvion <email@hidden>)

  • Prev by Date: Re: Write a file in utf8
  • Next by Date: Re: Write a file in utf8
  • Previous by thread: Re: Write a file in utf8
  • Next by thread: Re: Write a file in utf8
  • Index(es):
    • Date
    • Thread