Current location - Recipe Complete Network - Diet recipes - Reasons for copying by weight
Reasons for copying by weight
When we surf the internet, we don't have to worry about the coding format adopted by the website, but the garbled code that appears from time to time in the page will still give us a headache. This point, Firefox users have a deep understanding, using Firefox to browse the web is much more than using ie browser. The garbled code is mainly related to the character coding system. For example, garbled "Google" (Baidu, Google) often appears in a web page, which appears in the transformation of the old and new coding systems. Netizen est specially wrote an article to study the source of the problem:

In the process of conversion between Unicode and the old coding system, there must be some words that cannot be represented by Unicode. Unicode officials use a placeholder to represent these words, which is: U+FFFD replacement characters.

Then encode UTF-8 of U+FFFD, which is exactly''. If this'' is repeated many times, such as'', and then displayed in the environment of GBK/CP 936/GB 2312/GB18030, a Chinese character has 2 bytes, and the final result is: Fafa (0xEFBF), Jin.

Python code: 1. & gt& gt& gtu'\uFFFD '。 Encoding ('utf-8')*22. ' '3.& gt& gt& gt4.& gt& gt& gtPrintu' \ ufffd '。 Encoding ('UTF-8') * 2 Output result: "Copy".