The from, byteLength, lastIndexOf and other Buffer methods support encoding:Įncoding supports the following encoding: Node.js can store binary data in a Buffer, which is converted to a string using a character set. The encoding of node.js's BufferĮvery language supports encoding and decoding of character sets, as does Node.js. Utf-16 is fixed with 2 bytes and UTF-24 is fixed with 4 bytes.įinally, UTF-8 is widely used because it takes up the least space. Utf-8 uses variable-length storage schemes ranging from 1 to 6 bytes to save space. Utf-8, UTF-16, and UTF-24 are All Unicode encodings, but their implementation schemes are different. Therefore, different encoding schemes such as UTF-8, UTF-16, and UTF-24 have emerged. ![]() The INTERNATIONAL Organization for Standardization (ISO) decided that the same code could not have different meanings in different character sets, so it came up with The Unicode code, which included most of the world's codes so that each character had a unique code.īut ASCII code only needs 1 byte can be stored, and GBK needs 2 bytes, there are character sets need 3 bytes, and some as long as a byte storage but stored 2 bytes, more waste of space. ![]() Later, Europe also developed a character set standard, called ISO, and later China also developed a set, called GBK. The original character set, "charset," was ASCII, meaning 128 characters such as ABC, ABC, 123, because computers were first invented in the United States. How are characters stored? Is to rely on coding, different characters corresponding to different coding, and then in need of rendering according to the corresponding coding to check the font library, and then render the corresponding character graphics. After that, all kinds of information such as numbers and strings were stored based on bytes. ![]() However, only one bit represented too little information, so 8 bits were specified as a byte. ![]() The smallest unit of a computer is a bit, a 0 and a 1, which correspond in hardware by high and low levels.
0 Comments
Leave a Reply. |