Problems in sending Enclosed and Roman numbers through Java Mail


General J2EE: Problems in sending Enclosed and Roman numbers through Java Mail

  1. Hi All,


    I’m sending a mail from a Java class which will have Japanese characters including Enclosed numbers (i.e 1 enclosed in a circle, 2 enclosed in a circle like ① ② etc.) and roman numbers (like ⅠⅡ etc) in the subjects and contents.


    These characters are typically Vendor Defined Characters and supported in reserved rows of JIX X 208. For example they are supported by eucJP encoding in Solaris in the character range 0xada1 to 0xadfe. However, it seems that these characters are not supported by the definition of EUC_JP, SJIS or ISO2022JP (or ISO-2022-JP) in Java. Whenever I create a Java string using Unicode definitions of above mentioned characters (they are in the range of \u2460 in Unicode chart) and then convert that string to bytes using any of the above mentioned encodings the byte comes equivalent to ‘?’ mark. The conversion works fine if I mention UTF8 as encoding while creating the bytes.


    Now, as my application will send mails to the Japanese recipients and most of the Japanese mail servers cannot handle Unicode characters, I need to send the mail using ISO-2022-JP only. Actually ISO2022JP is the most widely used and recommended encoding for sending mails with Japanese strings to Japanese mail servers. But, as Java does not support the above mentioned characters as a part of ISO-20220JP encoding while converting the string contents to equivalent bytes those characters are getting converted to ‘?” mark (as I mentioned above) and appearing as “?” on the mail contents and subjects.

    Please note that if I send mails using UTF-8 as encoding the above mentioned characters appear perfectly fine on the mail. But, due to reason told before I cannot use UTF-8 as it might not be recognized by the recipient’s Japanese mail server.


    The problem is most probably happening while Java converts its Unicode string to bytes based on the target encoding as I’m able to send mails directly from other clients (like Microsoft Outlook client) containing above mentioned characters to the target mail server and the target recipients and those characters are appearing perfectly fine.


    Other information :

    Platform : Weblogic 8.1 (for implementation of javax.mail) running on Solaris 8, SendMail server for sending Mail, Microsoft Outlook Exchange Japanese version for mail client

    Related Code snippet :

                  message.setContent(sContents, "text/plain; charset=ISO2022JP");

    message.setSubject(sSubject, "ISO-2022-JP");


    If anyone can give me any hints/pointers/solution for solving the above mentioned problem it will be really helpful for me.




    Threaded Messages (1)

  2. Same problem faced[ Go to top ]

    Hi Sourav ,

    We are facing similar problem. You have posted this question long back. Did you get any solution for this problem ?

    Ashok Chawla