The original can be so simple, reversible character encoding issues

Garbled situation

Reversible case

  1. Box appears, A font is not the word, there will be box, only to find there the word font on the line. Such as "chaos" word, this font is not the word:
    Here Insert Picture Descriptiononly need to convert other fonts on the line
    Here Insert Picture Description

  2. Decoding and encoding mode is not the same, usually characterThe "" character. For example: "chaos" utf-8 character encoding method, decoding method in UTF-8 can be a normal display
    Here Insert Picture Descriptionbut showed distortion in case GBK,Binary coded character itself has not changedJust this binary number, GBK coding table in which the number of representatives of other characters
    Here Insert Picture Description

Irreversible situation

This problem usually occurs when a file is saved, the characters in a normal caseDisplayed as "?" Character. For example: GBK coding there is no "♠" This character, if forced to save this coding will be automatically converted to the character "?"
Here Insert Picture DescriptionForcibly hold off and on, and then a question mark appears next GBK, UTF-8 under the same is true
Here Insert Picture DescriptionHere Insert Picture Descriptionthis when the original character encoding of binary values changed again when already saved, anyway transcoding character, you can not find the original "♠" character

in conclusion

Character encoding reversible irreversible mainly to see saved, this character if there are appropriate numbers in this type of coding. We all know that ASCII coding, each letter has a corresponding number in English, such as "a" number which is 97 in ASCII, so save the "a" when you can save with this code, will not change when you save. The "♠" character is not encoded in GBK inside corresponding number, if forced to save, the system will automatically save as "?" Character number, leading to the original number is changed, even if you use other coding opened, there is no way to restore to the original number, resulting in the loss of character.

Published 11 original articles · won praise 10 · views 2108

Guess you like

Origin blog.csdn.net/dragoned_123/article/details/104878606