In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you the "static gb2312 coding in the project value in the Chinese garbled phenomenon how to do", the content is easy to understand, clear, hope to help you solve the doubt, the following let the editor lead you to study and learn "static gb2312 coding in the project value of Chinese garbled phenomenon how to do" this article.
Maybe the title description is not very clear.
The problem at that time is like this: in my system project, the reference art static page is in gb2312 format. When this code is obtained in the project, the utf-8-coded system will have style problems when loading the page, such as not being in the middle normally. (IE6 usually has style problems)
The solution is as follows (if gb2312 coding is necessary)
Add in webconfig
The copy code is as follows:
At this point, the page effect is normal.
However, if you encounter the function of transmitting values in Chinese on the page at this time, the Chinese characters of the values will be garbled. Even if encodeURIComponent is used in js, it can't be solved.
At this point, the following class is added to the project to specifically handle the transfer of request values back to utf-8 format.
The copy code is as follows:
Namespace XXX
{
/ / used to deal with the problem that UTF-8 can not get the style under IE6: change the encoding of web to gb2312,request and transfer the value back to utf-8 by this method
Public class ContentEncodingModule: IHttpModule
{
Public void Init (HttpApplication app)
{
App.BeginRequest + = new EventHandler (app_BeginRequest)
}
Public void Dispose ()
{
}
Void app_BeginRequest (object sender, EventArgs e)
{
HttpApplication app = (HttpApplication) sender
HttpWorkerRequest request = ((IServiceProvider) app.Context)
.GetService (typeof (HttpWorkerRequest)) as HttpWorkerRequest)
App.Request.ContentEncoding = System.Text.Encoding.UTF8
}
}
}
And reference this class in webconfig
Problem solved.
However, according to the reference article, try not to encode static pages in gb2312 unless there is a special purpose.
The above is "static gb2312 code in the project value in the Chinese garbled phenomenon how to do" all the content of this article, 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.
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.