BOM BOM BOM
In Mac::Glue, I have some code to automatically convert text to UTF-16 if typeUnicodeText (utxt) is expected. It uses Encode, and it seems to work fine for stuff like setting the iChat status message.
But when a user tried to send Unicode text to Adobe Photoshop CS, it failed. Hm.
After some experimentation, I found that if I sent the text without the BOM, using UTF-16BE to encode (big-endian is assumed without it ... though I am not sure if it will work that way should Mac OS ever run on a little-endian platform), it worked.
I found a technote describing how some apps couldn't handle the BOM when it was placed on the clipboard. I guess some apps have trouble with it in Apple events too, which is why I found that utxt data created by AppleScript and the like doesn't have the BOM either.
But when a user tried to send Unicode text to Adobe Photoshop CS, it failed. Hm.
After some experimentation, I found that if I sent the text without the BOM, using UTF-16BE to encode (big-endian is assumed without it ... though I am not sure if it will work that way should Mac OS ever run on a little-endian platform), it worked.
I found a technote describing how some apps couldn't handle the BOM when it was placed on the clipboard. I guess some apps have trouble with it in Apple events too, which is why I found that utxt data created by AppleScript and the like doesn't have the BOM either.
Leave a comment