alot icon indicating copy to clipboard operation
alot copied to clipboard

Wrong decoding of email with charset=ISO-2022-JP

Open josch opened this issue 5 years ago • 1 comments

Hi,

I have an email with:

Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit

And it gets rendered like this:

?$BL@F|?(B3?$B7n?(B23?$BF|?(B(?$BEZ?(B)PM12:00?$B!A!V%*%s%i%$%s%7%g%C%W8BDj!W%0%C%:$,HNGd3+;O!*?(B

?$B%a%s%P!<8DJL%"%$%F%`!*?(B
?$B!X%3%s%Q%/%H%_%i!<!Y!X%"%/%;%5%j!<%1!<%9!Y!X%0%i%9%-%c%s%I%k!Y$rHNGd!#?(B

?$B%"%/%;%5%j!<%1!<%9$K$O%i%s%@%`%U%)%H%+!<%I$b<}G<2DG="v?(B

?$B%0%i%9%-%c%s%I%k$O3F%a%s%P!<$,9a$j$r%;%l%/%H$7$^$7$?$C"v?(B

?$B$^$?!">e5-%"%$%F%`$r<}G<2DG=$J6&DL%G%6%$%s$N!X%a%C%7%e%]!<%A!Y$bEP>l!*?(B

?$B5$$K$J$k%G%6%$%s$d9a$j$J$I$O3F%Z!<%8$r%A%'%C%/!*?(B
?$BHNGd$r$*3Z$7$_$K"v"v?(B

The expected rendering would be this:

?????・3???23??・(???)PM12:00????????ェ??ウ??ゥ??、??ウ??キ??ァ??????????ョ??????ー?????コ????イゥ?」イ????ァ??シ?

??。??ウ?????シ?????・??「??、???????シ?
?????ウ??ウ?????ッ????????ゥ??シ????????「??ッ??サ??オ??ェ??シ??ア??シ??ケ????????ー??ゥ??ケ??ュ??」??ウ?????ォ???????イゥ?」イ???

??「??ッ??サ??オ??ェ??シ??ア??シ??ケ??ォ??ッ??ゥ??ウ???????????ゥ?????ォ??シ??????????エ???ッ??ス??ェ

??ー??ゥ??ケ??ュ??」??ウ?????ォ??ッ?????。??ウ?????シ????ヲ?????????サ??ャ??ッ????????セ????????」??ェ

??セ???????ク??ィ???「??、?????????????エ???ッ??ス??ェ??ア????????カ??、??ウ??ョ?????。?????キ??・?????シ???????????サ??エ?シ?

?ー???ォ??ェ????????カ??、??ウ????ヲ??????ェ??ゥ??ッ????????シ??ク????????ァ?????ッ?シ?
?イゥ?」イ???????・ス?????ソ??ォ??ェ??ェ

To reproduce this, here is the original mail that causes this issue.

You can decode that file by using:

python3 -c 'import email,sys;b=email.message_from_file(sys.stdin);print(b.get_payload(decode=True).decode("iso-2022-jp"))' < mail.txt

josch avatar Mar 22 '19 12:03 josch

yep I have 2 different kinds of errors: here is the concerned PR https://github.com/pazz/alot/pull/1369

teto avatar Mar 25 '19 05:03 teto