• 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: Unicode text to integer conversion from file data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Unicode text to integer conversion from file data (From: Donald Hall <email@hidden>)

  • Prev by Date: Unicode text to integer conversion from file data
  • Next by Date: Re: Prevent Canceling
  • Previous by thread: Unicode text to integer conversion from file data
  • Next by thread: Re: Prevent Canceling (Stockly, Ed)
  • Index(es):
    • Date
    • Thread