At 7:40 AM -0700 8/16/07, David Livesay wrote: >I opened some logs written by one of my scripts and found it was all >full of s?t?u?f?f? ?l?i?k?e? ?t?h?i?s?.? > >Turns out the files are all UTF-16. I generally use UTF-8 for >everything, and I see no real reason for writing plain old log files >in UTF-16. Mac OS Roman would be perfectly adequate, and somehow >seems more like what you'd expect to get from AppleScript. > >I can't find anything in the Language Guide that suggests you can >specify which text encoding to use. All it really says on the >subject is that "AppleScript provides partial support for...Unicode >Text," which they seem to equate with UTF-16. (Both UTF-8 and UTF-16 >are Unicode.) In light of that, it seems odd that they would make >UTF-16 the default encoding when they say they only provide "partial >support," whatever that means, for it. > >Does anybody know if it's possible to set the default text encoding, >sort of like the way you can set the default text item delimiters? Let me rephrase Mark's reply: write someStuff to someFile will make a UTF-16 file if someStuff contains Unicode text. So you *have* to specify, either: write someStuff to someFile as «class utf8» (since you seem to be familiar with utf8) or, as advised by Mark: write someStuff to someFile as string Emmanuel