From: Sam Roberts Date: 2003-04-17T13:41:29+09:00 Subject: Re: ANN: RFC 2047 decoding library (MIME format for non-ascii in mail headers) (Nobu, this question relates to using iconv to convert from iso-2022-jp to iso-2022-jp, which I would think would be an identity transform, but appears not to be, perhaps you have some insight?) The decoder is correctly pulling the base64 out of your example, it is then decoding it to binary, correctly I assume, unless there is a bug in ruby b64 code :-). However, Iconv.iconv() is dropping some of the trailing bytes when converting from what is (claimed to be) iso-2022-jp to is-2022-jp. Any idea what those characters are? Some sort of terminal reset sequence, perhaps? Maybe iso-2022-jp is stateful, in some way? I'm afraid I don't know anything about iso-2022-jp, and I'm just learning about iconv(), so I don't know that I can help right now. Sam Input strings: GyRCJEgbKEIgGyRCJFIkaSQsJEobKEI= (b64) "\e$B$H\e(B \e$B$R$i$,$J\e(B" (binary, iso-2022-jp) "\e$B$H\e(B \e$B$R$i$,$J" (Iconv.iconv from iso-2022-jp to iso-2022-jp) The other strings all have the same behaviour, and the same final 2 bytes missing from the iconv output. GyRCISIbKEIgGyRCJSslPyUrJUobKEI= "\e$B!\"\e(B \e$B%+%?%+%J\e(B" "\e$B!\"\e(B \e$B%+%?%+%J" IBskQiRIGyhCIBskQj5vTVE0QRsoQg== " \e$B$H\e(B \e$B>oMQ4A\e(B" " \e$B$H\e(B \e$B>oMQ4A" GyRCO3obKEI= "\e$B;z\e(B" "\e$B;z" Quoteing jupp@gmx.de, on Thu, Apr 17, 2003 at 12:35:07AM +0900: > The library seems to work fine with western character sets but it has > problems with Japanese (and possibly other languages as well). > I did use Mew (written in Japan) to write a message with ISO-2022-jp > encode header. The subject did read 'hiragana katakana jtyt-kanji' > where all words were written in the way they indicate (e.g. hiragana > in hiragana). Displaying the message header did leave my kanji > terminal (rxvt) in an unusable state - even issuing the 'reset' > command didn't help. I'll send a message entitled: "RFC 2047 to