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 > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to solve the html page garbled problem", 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 "how to solve the html web page garbled problem" this article.
The composition of html page garbled notice is mainly composed of html source code in calligraphy form and html coding consistent composition. However, no matter which situation causes garbled, it is necessary to set up web page coding at the beginning of the page.
Charset Encoding Settings
Screenshot of garbled performance of html web pages
First, the cause of garbled code
1, for example, the web page source code is gbk coding, while the form of Chinese calligraphy is utf-8 coding, so that the browser will open the html garbled. On the other hand, the web page is coded utf-8, the form is gbk will also appear garbled.
2. Html web page coding is gbk, and the step to call up the content encoded by utf-8 from the database will also constitute coding garbled.
3. Browsers can not actively detect web page coding, resulting in web page garbled.
Second, the intention to garbled the door path
First, the html web page source code coding is different from the Chinese character input coding.
Attempt method:
Use software development to compile HTML web page form, recommend the application of DW software for HTML code compilation and enlightenment.
Whenever possible, do not use notepad directly to compile HTML code.
Second, if the web page setting code is gbk, and the database data coding style is UTF-8, then measures to cross-examine the database data to reflect the data forward measures can be transcoded.
For example, PHP method model + mysql interrogation display data transcoding:
1. Mysql_query ("SET NAMES 'UTF8'"); / / Transcode the test data to utf8, that is, convert it to utf-8
2. Mysql_query ("SET NAMES 'GBK'"); / / Transcode the interrogation data to GBK, such as gbk2312
When writing a database connection file, write as follows:
$conn = mysql_connect ("$host", "$user", "$password"); mysql_query ("SET NAMES 'UTF8'"); mysql_select_db ("$database", $conn)
When working on the page in the future, hope for this sentence:
No matter how much the output database is in Chinese, it is still reflected on the page, and everything is normal.
In the DW CS4 version, the default is also the utf8 page.
Similarly, if the database join file is written by the source together, it reads:
Mysql_query ("SET NAMES 'GBK'")
The page should also be changed to:
Other asp French or other flashback language web transforms the coding method to Baidu cross-examination according to the theoretical situation.
Third, browsers are garbled.
This is mostly caused by the fact that your web page does not have a meta charset code. This causes the reader to fail to recognize the default coding type of your web page. The way of renovation:
1. If the web page is garbled when the browser is reading, find the menu of transcoding in the browser.
In the IE9 reader, the page that needs to be transcoded is blank with the right mouse button, and you can decide to "code".
When browsing a web page that is about to be transcoded in Aoyou reader, the menu "search"-> "Code" can decide to convert the code.
When dabbling in a web page that needs to be transcoded in the google reader, click the "three horizontal" icon in the upper right corner to decide "equipment"-> "coding" to switch the page code so that the reader can browse the page is not garbled.
Aoyou dabbler toggles the screenshot of the current dabbling web page coding
2. If the web page is inspired by itself, it is necessary for the web page to participate in the meta charset coding tag.
Or
If the conversion time, not notepad compilation growth meta charset coding tags to complete, how the same will form garbled, that is due to direct notepad growth or modification of the coding style, while the corresponding Html hypertext document form does not grow or change with the change of coding, this time requires the real sense of transcoding, so it is best to encode with the help of enlightening software increase and correction.
Recommend correcting codes in DW software. Develop code modification or enhancement in DW software, and reload the encoded web page on the side.
The above is all the contents of this article entitled "how to solve the problem of garbled html pages". 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.