Decoding the content (text/plain) for charset "iso-2022-jp"
838162Feb 9 2011 — edited Feb 14 2011Hi there,
I am using IMAP protocol to receive new email message and retrieving the contents using java mail API InputStream is = p.getInputStream()
The part content type is text/plain and text/html and charset is "iso-2022-jp"
The contents contain Japanese Characters as well. In my code, I am decoding the contents using charset "iso-2022-jp" to get the actual content (verified by sending the same content using SFTP client built on java mail APIs). The contents are decoded properly in Linux OS but not working properly on Windows OS.
Can anybody help me out the root cause of this problem? The code snippet is as follows
InputStream is = p.getInputStream();// p is Part object
byte[] bytesJap = IOUtils.toByteArray(is); // org.apache.commons.io.IOUtils
String decodedBytesJap = decodeBytes(charset, bytesJap);
The content I am getting while deploying the program
on Linux box:
-----------------------------------------
Subject: FW: Japanese characters
聖書に示された神の純粋なみ言葉に基づいて
----------------------------------------------
on Windows box:
-----------------------------------------
Subject: FW: Japanese characters
$B@;=q$K<($5$l$??@$N=c?h$J$_8@MU$K4p$E$$$F(B&
----------------------------------------------