Re: Unicode text to integer conversion from file data
Re: Unicode text to integer conversion from file data
- Subject: Re: Unicode text to integer conversion from file data
- From: Emmanuel <email@hidden>
- Date: Sat, 28 Oct 2006 11:43:41 +0200
At 11:54 PM -0600 10/27/06, Donald Hall wrote:
set theRawData to (read theFile) as Unicode text
By default, 'read theFile' will read the file as ASCII. You saved the
string "59" as "Unicode text", which really means "UTF-16". You now
have 4 bytes in your file. Now you "read theFile", making the 4 bytes
into 4 ASCII characters (including two '0'). That makes an odd
string. You then convert it to Unicode text, where the 4 bytes will
be converted into 4 unicode characters.
You should have written: (read theFile as Unicode text). That will
instruct AppleScript to read the file as a UTF-16 file, which it is.
Emmanuel
_______________________________________________
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/mailman//archives/applescript-users
This email sent to email@hidden