Re: Write a file in utf8
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