Mailing Lists: Apple Mailing Lists

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

Problem reading UTF8 source email from OS X Mail application



Hi,

I'm attempting to read the 'source' of an Mail email message via the
following (simplified) script ...

tell application "Mail"

     return source of message 3 of mailbox "Text"

end tell

The email in question contains some Chinese characters in UTF8 format. The
script seems to mangle these Chinese characters regardless of the coercion
I use (I've tried as Unicode text, as String, as Internation text and as
<class utf8).

The Chinese characters are represented in UTF8 by three unicode bytes
however when I received the result from the script each one of these bytes
is represented by two or more bytes as if a secondary unicode conversion
has happened for example

original Unicode character      =  ”µ
represented as Unicode bytes    =    232        142        138
result of script                = (195 168)  (194 142)   (194 138)


However, the script ..

tell application "Mail"

     return content of message 3 of mailbox "Text"

end tell

will work correctly, ie. the Chinese unicode characters are preserved.

Finally, this behaviour also occurs with Eudora indicating that it may be
an AppleScript/AppleEvent problem.

I'd really appreciate it if you could shed some light on whats happening
here and how I may work around the problem,

Many thanks for your help.

Best regards .... Tim

 _______________________________________________
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



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.