Fare una cosa odiosa può divenire interessante se impari qualcosa. Ecco, nell’abuso di mailing dedicati al database di inter.it, oggi ho raccolto una sfida.
Comporre una mail interamente in giapponese. Se il corpo della email è molto semplice (basta mettere content-type html e, al limite, encodare come entities html gli ideogrammi) per il soggetto della mail non lo è altrettanto.
Fare apparire ideogrammi nel soggetto non è semplice. Questo è il punto di partenza
Ok, so to post a short update, thanks to the two helpful answers, I’ve managed to get the right format and encoding. Now, Outlook gives something that resembles the correct subject:
=?iso-2022-jp?B?6 Japanese test に各々の視点で語ってもらった。 6相当の防水?=
However, the exact same email in Outlook Express gives subject like this:
=?iso-2022-jp?B?6 Japanese test 縺ォ蜷・・・隕也せ縺ァ隱槭▲縺ヲ繧ゅi縺」縺溘・ 6逶ク蠖薙・髦イ豌エ?=
Furthermore, when viewed in the Inbox view in Outlook Express, the email subject is even more weird, like this:
=?iso-2022-jp?B?6 Japanese test ??????????????? 6???????=
Gmail seems to be working in the similar fashion to Outlook, which looks correct.
E, secondariamente, occorre predisporre lato server gli encoding necessari. Queste le cose da tenere in mente!
Â
|
I’ve been dealing with Japanese encodings for almost 20 years and so I can sympathize with your difficulties. Websites that I’ve worked on send hundreds of emails daily to Japanese customers so I can share with you what’s worked for us.
“An ‘encoded-word’ may not be more than 75 characters long, including ‘charset’, ‘encoding’, ‘encoded-text’, and delimiters. If it is desirable to encode more text than will fit in an ‘encoded-word’ of 75 characters, multiple ‘encoded-word’s (separated by CRLF SPACE) may be used.” |
MAÂ con ISO-2022-JP non si risolve il problema del soggetto del messaggio.
Ecco come ho risolto, con il modulo MIME::Words. Grazie a Fabio: serve encoding 7 bit UTF-8, e non ISO-2022!
$titoloen = MIME::Words::encode_mimeword($subject_addon.’株式会社エス・ティー・ワールドがインテル・ミラノの公式旅行代理店に!’, ‘B’, ‘UTF-8’);