In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to solve the jsp linux garbled problem". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the jsp linux garbled problem".
Solutions to jsp linux garbled: 1, modify "LANG=" zh_CN.GB2312 "" under ROOT users; 2, specify gb2312 or GB2312 coding when dealing with strings containing Chinese characters.
This article operating environment: linux5.9.8 system, Dell G3 computer.
How to solve the jsp linux garbled problem?
The solution of JSP garbled code under Linux
I use gb2312 coding in JSP
The default of LINUX system is UTF-8.
Therefore, it causes websites running under LINUX to obtain that the Chinese characters in the database are all garbled, and the specific solutions are as follows:
1. Under ROOT users
Vi / etc/sysconfig/i18n
Change the original:
LANG= "zh_CN.UTF-8" SUPPORTED= "zh_CN.UTF-8:zh_CN:zh" SYSFONT= "latarcyrheb-sun16"
Change to
# vi / etc/sysconfig/i18n modifies the contents of the file # indicates that it is commented # LANG= "zh_CN.UTF-8" # SUPPORTED= "zh_CN.UTF-8:zh_CN:zh" # SYSFONT= "latarcyrheb-sun16" LANG= "zh_CN.GB2312" LANGUAGE= "zh_CN.GB2312:zh_CN" SUPPORTED= "zh_CN.GB2312:zh_CN:zh_CN.UTF-8" SYSFONT= "lat0-sun16" SYSFONTACM= "8859-15"
two。 Gb2312 or GB2312 encoding should be specified when dealing with strings containing Chinese characters
For example: String caption = new String (caption.getBytes ("iso-8859-1"), "gb2312"); / / parameters passed, specify encoding String templateContent = ""; FileInputStream fileinputstream = new FileInputStream (filePath); / / read template file int lenght = fileinputstream.available (); byte bytes [] = new byte [lenght]; fileinputstream.read (bytes); fileinputstream.close (); templateContent = new String (bytes, "GB2312") / / specify the code thank you for reading, the above is the content of "how to solve the problem of jsp linux garbled". After the study of this article, I believe you have a deeper understanding of how to solve the problem of jsp linux garbled, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.