Re: Odd File Write Issue
Re: Odd File Write Issue
- Subject: Re: Odd File Write Issue
- From: Emmanuel LEVY <email@hidden>
- Date: Sat, 5 Dec 2009 21:18:44 +0100
Well-known issue, andy. At some point (maybe that was Tiger), "write
this_data to the open_target_file" would (provided this_data is
Uniocde, which is very frequent, many apps talk Unicode) make a UTF-16
file (it used to produce Macintosh-encoded files before). UTF-16 is a
Unicode file format where our character set is rendered on two bytes,
one of them being 0.
I think that, to make Macintosh encoded files, you have to say
"write ... as string" and to make UTF-8 files (where our character set
is rendered mostly like ISO-8859) you says as «class utf8».
Maybe that's documented in the "write" entry in Standard Additions'
AppleScript dictionary.
Emmanuel
On Dec 5, 2009, at 8:13 PM, andy knasinski wrote:
We're doing some text manipulation and then writing it to disk. For
one client, on an older PPC mac with 10.4.11 they are getting ASCII
null characters between every character written to disk. If I look
at the string being written, it's correct (no nulls) but on disk it
has them.
What would cause this to happen!?
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
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