An error occurred while running the xml encoding format in tomcat. There is no problem in eclipse. tomcateclipse
There is no problem in running it directly in eclipse. An error is reported when it is published to tomcat.
All are set to UTF8 encoding .....
Xml data with Chinese error:
Com.sun.org. apache. xerces. internal. impl. io. MalformedByteSequenceException: 2 words
The byte 2 of the UTF-8 sequence of the section is invalid.
Xml data does not contain Chinese characters:
Com.sun.org. apache. xerces. internal. impl. io. MalformedByteSequenceException: 1 word
The byte 1 of the UTF-8 sequence of the section is invalid.
Solution:
Add a sentence to the catalina. bat configuration file.
Set JAVA_OPTS =-server-Dfile. encoding = UTF-8
Run with UTF-8 encoding
System Code problems found later
The utf8 parameter must be included in the md5 encryption process of the payment signature; otherwise, the gbk encoding method will be used.
ResultString = byteArrayToHexString (md. digest (resultString. getBytes ("UTF-8"); // the correct method
Refer:
Http://blog.csdn.net/yjg428/article/details/44107667