Zookeeper
When saving username with a cookie, the cookie value cannot be saved in Chinese, and the following error is reported:
Control Character in cookie value, consider base64 encoding your value
The following error occurs: Response. addcookie (cookie );
This problem has also been encountered in programming, mainly because of the number of illegal tokens in the cookie value, this error is reported if characters such as "\ r \ n" and "\ n" exist, but I am a username. It does not exist, I set the cookie value to a default Chinese username. If the execution result is correct, the same error occurs. The result shows that Chinese characters cannot be saved in the cookie.
Finally think about converting Chinese to UTF-8 string to save should be no problem, that is, using urlencoder. encode ("Chinese username", "UTF-8"); this converts the Chinese username to a UTF-8 string, when executed. At the end of receiving this value, use urldecoder. Decode (cookies. getvalue (), "UTF-8"); to decode the Chinese username I want.
Urlencode and urldecode are included in the java.net package.
Cookie cannot be saved in Chinese