tomcat 中部署的应用响应json数据乱码解决办法

原来响应的json中中文乱码


找到 Tomcat\conf\server.xml文件,加上 URIEncoding='UTF-8'

   
    
    

再在 java程序中

		// 设置编码
		response.setContentType("text/html;charset=utf-8");

重启 tomcat ,如果还是不行,则在 servers 透视图中删除 现有 的tomcat ,再重新引入。


原来响应的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"
				}
			]
		}
	]
}

改善后


你可能感兴趣的:(Eclipse)