java Httpserver 传递过来的json里面的汉字 接收到的每个汉字对应一个问号“?” 请问该如何解决这个问题 servlet从jsp获得汉字怎么成了一个个问号
java Httpserver \u4f20\u9012\u8fc7\u6765\u7684json\u91cc\u9762\u7684\u6c49\u5b57 \u63a5\u6536\u5230\u7684\u6bcf\u4e2a\u6c49\u5b57\u5bf9\u5e94\u4e00\u4e2a\u95ee\u53f7\u201c\uff1f\u201d \u8bf7\u95ee\u8be5\u5982\u4f55\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset:utf-8");
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");\u8fd9\u4e24\u4e2a\u8bbe\u7f6e\u4e00\u822c\u90fd\u662f\u9488\u5bf9post\u65b9\u6cd5\u4f20\u503c\u7528\u7684\uff0c
String name = new String(request.getParameter("name").getBytes("ISO-8859-1"),"utf-8"); \u8fd9\u79cd\u65b9\u5f0f\u662fget\u65b9\u6cd5\u4f20\u503c\u7528\u7684\uff0c\u4e00\u822c\u5c31\u662f\u5c06\u503c\u76f4\u63a5\u5199\u5728url\u4e2d\u4f20\u503c\u65f6\u7528\u5230\u3002\u4e24\u79cd\u4e8c\u9009\u4e00\uff0c\u53ea\u8981\u4f60\u9875\u9762\u7684\u7f16\u7801\u65b9\u5f0f\u548cservlet\u7f16\u7801\u65b9\u5f0f\u4e00\u81f4\uff0c\u57fa\u672c\u4e0a\u5c31\u53ef\u4ee5\u89e3\u51b3\u4e86\u3002
用一个过滤器把URL转换成utf-8格式就可以了
扩展阅读:macbookpro色域708 ... x86国产cpu ... 韩国macbookpro ... matebook x pro2023 ... macbookair色域 ... 国产xbox series ... huawei matebook x ... www.sony.com.cn ... china visa services ...