设置字符编码集即可Cookie cookie = new Cookie("user",URLEncoder.encode(nMessage, "UTF-8")); response.addCookie(cookie);