当前位置:网站首页>Program coding in programming

Program coding in programming

2022-06-10 08:14:00 Binary star

ASCII code

ASCII (American Standard Code for Information Interchange): The American Standard Code for information interchange (ASCII) is a computer coding system based on the Latin alphabet , Mainly used to show modern English and other western European languages . It's the most common information exchange standard , And equivalent to international standards ISO/IEC 646.ASCII The first time it was published as a standard type was in 1967 year , The last update was in 1986 year , So far, we have defined 128 Characters .— From baidu baike

ASCII Code table link

ASCII It's the American Standard , So it can not well meet the needs of other countries .

ANSI code

ANSI It's a character code , To make the computer support more languages , Usually use 0x00-0x7f Scope 1 In bytes 1 English characters . Use beyond this range 0x80-0xFFFF Encoding , That is, extended ASCII code .

ANSI Encoding represents English characters with a byte , Two or four bytes for Chinese .

// C Used in language wchar_t Two bytes  
wchar_t var = L' Liu ';

Unicode code

In order to solve different countries ANSI Coding conflicts ,Unicode emerge as the times require : If every symbol in the world is given a unique code , Then the confusion will disappear . This is it. Unicode, It's like its name means , It's a code for all the symbols .

But the problem is , English letters that could have been stored in one byte are in Unicode There must be two bytes in it , This creates waste . So is there one that can eliminate garbled code , And avoid wasteful coding ? The answer is UTF-8!

UTF-8

UTF-8(8 Bit ,Universal Character Set/Unicode Transformation Format) Is aimed at Unicode A variable length character encoding of . It can be used to express Unicode Any character in the standard , And the first byte in its encoding is still the same as ASCII Compatible with , Make the original handle ASCII Character software does not need or only needs a few modifications , Can continue to use . therefore , It's gradually becoming email 、 Web pages and other applications that store or transmit text , Preferred encoding .

In computer memory , Unified use Unicode code , When you need to save to a hard disk or need to transfer , Just switch to UTF-8 code . When editing with Notepad , Read from file UTF-8 The characters are converted to Unicode Characters in memory , After editing , Save it with Unicode Convert to UTF-8 Save to file .

原网站

版权声明
本文为[Binary star]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206100807139994.html