A module called XML RPC call, today's customer (South Korea) sent Mail, log files showed IOException, error: java.io.ioException: Invalid Character Data Corresponding to Xml Entity & # 50920, see Look at the data called, there is a non-ASCII code, it is estimated to be Korean, tested in Chinese, and the same mistake. I checked the Internet, saying that it is a non-ASCII code in the XMLRPC implementation of Apache because some XML parser analyzes the XML structure of non-ASCII code. The String type of XMLRPC can only use the ASCII code.
I want to think about it, the solution is to encode the string of the String type. Simplely use the base64 class in Apache.commons.codec, encoding the string to base64 and then transfer. However, this will be introduced into the apache.commons.codec package, and later discovered that the Catalina.jar package comes with the Tomcat itself in the JBoss Tomcat environment we used. So use directly, get it. Test code
Import org.apache.catalina.util.base64;
/ *
* * Todo to change the Template for this generated type comment go to * window - preferences - java - code style - code templates
* /
Public class testcharset {public static
Void
Main (String [] args) {base64 base64
=
New
Base64 (); string temp_p
=
"
Have a meeting
"
;
Byte
[] ENBYTES
=
Base64.encode (Temp_p.getbytes ()); String Temp
=
New
String (eNbytes); System.out.Println (TEMP); String Temp1
=
New
String (Base64.Decode (eNbytes)); system.out.print (TEMP1);}}
Run results: V6Q74chl meeting