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

How to deal with all the file coding and garbled problems of java,php and html

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you "how to deal with all java,php and html file coding and garbled problems", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to deal with java,php and html all file coding and garbled problems" this article.

Garbled in php file (for example, a.php file is garbled in browser):

Header ("Content-Type:text/html;charset=utf-8") is used to set up a web page.

Mysql_query ("set names utf-8") sets the database.

Struts in java:

Chinese garbled generally means that when the request parameter has Chinese, the correct Chinese cannot be obtained in Action. There are two ways to solve this problem in Struts2:

If you set the pageEncoding= "utf-8" of the JSP page, there will be no Chinese garbled.

If the pageEncoding= "GBK" of the JSP page, then you need to modify the struts.i18n.encoding=GBK by adding the following statement to the struts.xml to modify it.

The copy code is as follows:

……

The above two methods can solve the Chinese parameters in the POST request, but the Chinese parameters in the GET request cannot be solved. The garbled codes of the Chinese parameters in the GET request need to be solved by modifying the server.xml file of Tomcat. Modify the following contents and add URIEncoding= "GBK":

The above is all the contents of this article entitled "how to deal with all the file coding and garbled problems of java,php and html". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report