Linux environment under CentOS7 Tomcat7.9 receives a request to solve the garbage problem in Chinese

• Linux environment under CentOS7 Tomcat7.9 receives a request to solve the garbage problem in Chinese

2019-12-10 (Tuesday-cloudy)

This is a blogger personal blog of IT development technology finishing small notes .

development tools:

IDEA 2019.2 ;
VMware pro 15.5
CentOS 7.0
SecureCRT 7.0
JDK 1.8
MySQL 5.6
TomCat 7.9
SpringBoot 1.5.8

Problem Description:

在开发文件管理系统时,发现文件的储存(上传)正常,数据库的查询正常,删除正常,下载时部分文件访问报错。检查文件目录,文件存储正常,名称正常。
同时,测试登录时的中文名称用户,后台显示,查询为NUll 。

Causes

介于以上原因,打开Chrome的前端控制台,发请求,发现 请求中含有中文的部分都变为????,因此可以确定是 TomCat 在处理请求时,编码格式异常。

Solution

By modifying the tomcat in the conf *** *** the server.xml file folder in
<Connector Port = "8080" = Protocol "the HTTP / 1.1"
connectionTimeout = "20000"
the redirectPort = "8443"
the URIEncoding = " . 8-UTF " />

	向其中,添加代码 URIEncoding="UTF-8"。
	再次重启服务器测试,发现成功获取中文请求。
Published 32 original articles · won praise 1 · views 1183

Guess you like

Origin blog.csdn.net/ASYMUXUE/article/details/103479426