Recently in a project, the overall project is to deal with the database, take out data to be submitted to an interface through the HTTP protocol. The specific function is not much to say, just talk about the inside of a point--coding problems
In the project, it involves taking the MD5 value of all the data.
In Java projects, individuals prefer to change the project's default encoding to UTF-8. The development tools used are primarily eclipse. However, strange problems have arisen. When I debug my project in the IDE, there's no problem, but after I hit the jar package, I passed
When running, each time the data is submitted, the interface will return the data saying that my signature is incorrect. In other words, it's my last step, and it's a problem when I do MD5 operations.
Why not just hit the jar bag? After several twists and turns, but also to see the parameters of the hashcode, but also to check all the submitted content of the hexadecimal data, found that the text encoding the problem. is correct in Eclipse, but the startup command line has not set the string default encoding after the jar package is played, so the Java virtual machine runs according to the default encoding of the system in which it resides. I'm using the Windows environment, so naturally it's GBK encoded.
Later, by consulting the data, the solution is to add a parameter to specify the encoding:
Java-dfile.encoding=utf-8-jar Project.jar
That's it. The tool is running properly.
Thank you for reading, I hope to help you, thank you for your support for this site!