I use a number of scripts to set standard contact information, a sample of which is below. This particular one sets Japanese contact information, but only will work if Entourage is set to Japanese with the language register. The interesting thing is that the data, once stored into Entourage, will be displayed correctly regardless of whether or not Entourage is registered for Japanese. Have I missed something in the scripting which is causing this problem, or is it really necessary to set Entourage to Japanese to set Japanese data? Why won’t this script work correctly if Entourage is set to English with the language register?
For every line where you set an entry in Japanese, add 'as Unicode text', eg.:
set company of contact1 to "伊藤忠テクノサイエンス" as Unicode text
Although Entourage, like OE 5 before it, is implemented as Unicode, AppleScript had terrible or no unicode until very recently. So there has always been an automatic coercion to string. However, adding 'as Unicode text' since OS 9.1 or so works perfectly now. (In OS 8.6 - 9.0 you'd get raw data but could sometimes still work with it.)
There are still AppleScript bugs with Unicode: text item delimiters don't work right with it, nor do alias file paths. But they're all getting fixed: the Finder's AppleScript does everything in Unicode perfectly now. So does Excel's.
I have requested in the next version of Entourage that the automatic coercion to string be turned off, although it will break some old scripts. Dan has said he'll think about it.
For now, the simple ways i which you're using Japanese should work with 'as Unicode text'. I think. I've noticed that it seems to be essential to add that when reading text. I'm a little surprised to see it crop up when setting properties, but probably it's because the encoding is mis-transcribed. Try it anyway, and let us know what happens.
--
Paul Berkowitz
MVP Entourage
