Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode text to integer conversion from file data



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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >Unicode text to integer conversion from file data (From: Donald Hall <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.