Example: The word "yungojunhua. Phpurlencode is used at the beginning, and then javaurldecode, the word "quit" is called zookeeper. Use PHPbase64_encode, and then use javadecode (org. apache. commons. codec. binary. base64 package), & quot; success & quot; word OK, but "... example: The word "yungojunhua.
Php urlencode is used at the beginning, and then the java urldecode, "encoding" is used.
Use PHP base64_encode, and then use java decode (org. apache. commons. codec. binary. base64 package), the word "Jun" is OK, but the word "Jun Hua" is wrongly formed.
Search is a non-standard base64 decoding algorithm used by java, so.
Reply content:
Example: The word "yungojunhua.
Php urlencode is used at the beginning, and then the java urldecode, "encoding" is used.
Use PHP base64_encode, and then use java decode (org. apache. commons. codec. binary. base64 package), the word "Jun" is OK, but the word "Jun Hua" is wrongly formed.
Search is a non-standard base64 decoding algorithm used by java, so.
The garbled characters are caused by inconsistent codes.
The urlencode encoding in php is consistent with the system encoding (for example, windows Default gb2312 and ubuntu default UTF-8)
Therefore, you must first determine your system encoding, and then pass in the encoding when calling the java decode method based on the obtained system encoding (considering that your example contains traditional Chinese characters, we recommend that you use UTF-8 encoding. The following is an example of using UTF-8 encoding (in the php environment, ubuntun)
Output: % E8 % 98% 8B % E6 % 9E % 9C % E5 % 90% 9B % E5 % 8D % 8E
String ret = java.net.URLDecoder.decode("%E8%98%8B%E6%9E%9C%E5%90%9B%E5%8D%8E", "utf-8"); System.out.println(ret);
Output: yunguo Junhua