Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Solve the problem of Chinese garbled data inserted by Tomcat into MySQL under Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

First, problems

Projects developed with eclipse on windows work well on windows. When deployed to Tencent Cloud, inserting data into the MySQL database is garbled in Chinese.

II. Solutions

1. Try one

Use insert statement to insert Chinese directly on linux, normal

2. Try two

Add useBodyEncodingForURI= "true" to the tomcat configuration file server.xml, no

3. Try three

Add URIEncoding= "UTF-8" to the tomcat configuration file server.xml, no

4. Try four

Because it is a SSM framework project, a filter has been added to web.xml

EncodingFilter

Org.springframework.web.filter.CharacterEncodingFilter

True

Encoding

UTF-8

EncodingFilter

/ *

no way

5. Try five

Add? characterEncoding=utf-8 to the jdbc path of the mybatis configuration file, success!

The modified jdbc access path is:

Jdbc:mysql://localhost:3306/daad?characterEncoding=utf-8

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report