powered by Jive Software

Support for double-byte text (languages such as Japanese, Korean, Chinese)

I know Java & Jabber support unicode, and so in theory, sending a message whose body text is a double-byte string should work, but we’'ve not gotten it to work with Smack, i.e. the recipient gets the message but the body text is mangled.

We’'ve checked the encoding and transmission formats (xml, utf-8, charset=iso-8859-1), client sender & recipient settings (both sender & recipient clients have the right fonts and encoding functions, since they can read double-byte messages from non-Smack clients), and as far as we can tell, we are using the right formats and encodings, but the message body always comes out mangled.

Does anyone have any experience with this?

Ok, so I’'ve done a bit more research and have narrowed down the cause (drumroll please) :

Basically, the problem is the sendMessage(String text) method in the org.jivesoftware.smack.Chat object.

When it’'s called using a String containing double-byte data encoded as UTF-8, the body text of the corresponding message packet Smack sends out is NOT encoded UTF-8.

I couldn’'t believe it at first, but this is definitely what is happening.

Is there a way to make sure that calling Chat.sendMessage() will create a UTF-8 encoded xml packet?