原来响应的json中中文乱码
找到 Tomcat\conf\server.xml文件,加上 URIEncoding='UTF-8'
<!-- 原配置 <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/> --> <!-- 解决响应时中文乱码 --> <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding='UTF-8'/>
// 设置编码 response.setContentType("text/html;charset=utf-8");
原来响应的json中中文乱码:
{ "rspCode":"", "rspDesc":"1", "isError":true, "resultList":[ { "resourcesId":1, "resourcesName":"???", "resourcesType":"collapseOne", "resourcesDoscs":"headingOne", "resourcesList":[ { "resourcesName":"??????", "resourcesUrl":"Auditvces.auditFileQuery" }, { "resourcesName":"????????(??)", "resourcesUrl":"Auditvces.auditDiffFileDetail" }, { "resourcesName":"????????(??)", "resourcesUrl":"Auditvces.auditDetailSelect" }, { "resourcesName":"???????", "resourcesUrl":"Auditvces.auditDifferenceRate" }, { "resourcesName":"?????????", "resourcesUrl":"Auditvces.auditComparedSelect" }, { "resourcesName":"??????", "resourcesUrl":"Auditvces.warnDetailsFind" }, { "resourcesName":"??????", "resourcesUrl":"Auditvces.warnStructureFind" } ] }, { "resourcesId":2, "resourcesName":"???", "resourcesType":"collapseTwo", "resourcesDoscs":"headingTwo", "resourcesList":[ { "resourcesName":"??????", "resourcesUrl":"Auditvces.rechargeSellFile" }, { "resourcesName":"????????(??)", "resourcesUrl":"Auditvces.rechargeSellDiffDetails" }, { "resourcesName":"????????(??)", "resourcesUrl":"Auditvces.rechargeSellDiffStructure" }, { "resourcesName":"???????", "resourcesUrl":"Auditvces.rechargeSellRate" }, { "resourcesName":"?????????", "resourcesUrl":"Auditvces.rechargeSellChain" }, { "resourcesName":"????(??)", "resourcesUrl":"Auditvces.rechargeSellWarnDetails" }, { "resourcesName":"????(??)", "resourcesUrl":"Auditvces.rechargeSellWarnStructure" } ] }, { "resourcesId":3, "resourcesName":"??????", "resourcesType":"collapseThree", "resourcesDoscs":"headingThree", "resourcesList":[ { "resourcesName":"??????", "resourcesUrl":"Auditvces.querySettleFile" }, { "resourcesName":"????????????", "resourcesUrl":"Auditvces.queryProvUploadFile" }, { "resourcesName":"????????????", "resourcesUrl":"Auditvces.queryCMSZRechargeDifFile" }, { "resourcesName":"????(??)", "resourcesUrl":"Auditvces.searchSellMain" }, { "resourcesName":"????(??)", "resourcesUrl":"Auditvces.searchSellMainDeQuery" }, { "resourcesName":"????????", "resourcesUrl":"Auditvces.queryUpSum" }, { "resourcesName":"????????", "resourcesUrl":"Auditvces.queryDownSum" }, { "resourcesName":"??????", "resourcesUrl":"Auditvces.searchSellMainDetails" }, { "resourcesName":"?????", "resourcesUrl":"Auditvces.searchSellMainChain" }, { "resourcesName":"?????", "resourcesUrl":"Auditvces.searchSellMainYoY" } ] }, { "resourcesId":4, "resourcesName":"????", "resourcesType":"collapseFour", "resourcesDoscs":"headingFour", "resourcesList":[ { "resourcesName":"????", "resourcesUrl":"Auditvces.rechargeableCardRun" } ] }, { "resourcesId":5, "resourcesName":"????????", "resourcesType":"collapseFive", "resourcesDoscs":"headingFive", "resourcesList":[ { "resourcesName":"????(?)", "resourcesUrl":"Auditvces.monthClearingFile" }, { "resourcesName":"?????(?)", "resourcesUrl":"Auditvces.monthReportPro" }, { "resourcesName":"????(??)", "resourcesUrl":"Auditvces.monthStatements" }, { "resourcesName":"????(??)", "resourcesUrl":"Auditvces.monthReportNat" }, { "resourcesName":"????????(??)", "resourcesUrl":"Auditvces.upSunReportNat" }, { "resourcesName":"??????", "resourcesUrl":"Auditvces.gistReport" } ] }, { "resourcesId":6, "resourcesName":"????", "resourcesType":"collapseSix", "resourcesDoscs":"headingSix", "resourcesList":[ { "resourcesName":"????", "resourcesUrl":"Auditvces.monitoringInterface" }, { "resourcesName":"??????", "resourcesUrl":"Auditvces.perTimeIndex" }, { "resourcesName":"TPS??", "resourcesUrl":"Auditvces.TPSIndex" }, { "resourcesName":"????????", "resourcesUrl":"Auditvces.provincialAverage" }, { "resourcesName":"????????", "resourcesUrl":"Auditvces.propertyTimeTrend" }, { "resourcesName":"??????", "resourcesUrl":"Auditvces.propertyCourse" }, { "resourcesName":"??????", "resourcesUrl":"Auditvces.propertystatisticalForm" }, { "resourcesName":"??????", "resourcesUrl":"Auditvces.devicePrpoertyShow" }, { "resourcesName":"??????", "resourcesUrl":"Auditvces.systemWatch" } ] }, { "resourcesId":7, "resourcesName":"????", "resourcesType":"collapseSeven", "resourcesDoscs":"headingSeven", "resourcesList":[ { "resourcesName":"????", "resourcesUrl":"Auditvces.rolesManagement" }, { "resourcesName":"????", "resourcesUrl":"Auditvces.usersManagement" }, { "resourcesName":"????", "resourcesUrl":"Auditvces.authorizationManagement" } ] } ] }