Cookie cookie = new Cookie("user",URLEncoder.encode(nMessage, "UTF-8"));
response.addCookie(cookie);
设置字符编码集即可
转载于:https://www.cnblogs.com/baryon/p/9611408.html