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
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
First type: HTML web source code encoding and Chinese word Enter the encoding.
Workaround : Writing for HTML web pages using professional editing software. For exampledw.
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
Third type: browserCauses garbled
. 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.2
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 MetaCharset
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!