What is the reason why HTML web pages garbled?

Xiaobian to share the reason why the HTML page garbled is caused, I hope everyone will read this article, let us discuss it!

, Conditioning causes

1, If the web page source code is GBK The text in the content is UTF-8 , then HTML garbled occurs when the browser is opened. It will also appear garbled. 2

, HTML webpage coding is

GBK , but the program is called from the library is UTF-8 encoded content Will cause encoding garbled. 3, The browser cannot automatically detect the webpage coding, resulting in tarcodes.

Second, solving garbled method

造成html网页乱码的原因是什么 First type

: HTML web source code encoding and Chinese word Enter the encoding.

Workaround : Writing for HTML web pages using professional editing software. For example


Try not to write directly to the Notepad. The second
: web page setting encoding is


, but the database storage data encoding format is UTF-8 , at this time, the program query Database data display data is transferred.

MySQL_QUERY (“SET NAMES ‘UTF-8’) // Put the query data transcoding is UTF-8 Then do not forget the following:


Third type: browserCauses garbled

This reason is generally the page is not set
 Meta CHARSET . Leading the browser does not recognize your web page default encoding type.   

, if the browser browsses, the web is garbled, find the conversion encoded menu. 造成html网页乱码的原因是什么


If you develop a web page yourself, you must add Meta Charset encoded tag.

If it is converted, it is not a notepad editor added Meta


The encoding tag is completed, which will also cause garbled, because the direct notepad adds or modifies the coded format, and the corresponding HTML hypercraft document content does not change or modify the code format, this time needs to true The transcodation, so it is best to write the code by the professional development software. After reading this article, I believe that you have a certain understanding of the reason why HTML website garbled, want to know more related knowledge, welcome to pay attention to Tumi Cloud Industry Information Channel, thank you for reading!

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment