zoukankan      html  css  js  c++  java
  • What's the difference between encoding and charset?

    I am confused about the text encoding and charset. For many reasons, I have to learn non-Unicode, non-UTF8 stuff in my upcoming work.

    I find the word "charset" in email headers as in "ISO-2022-JP", but there's no such a encoding in text editors. (I looked around the different text editors.)

    What's the difference between text encoding and charset? I'd appreciate it if you could show me some use case examples.

     
    回答:

    Basically:

    1. charset is the set of characters you can use
    2. encoding is the way these characters are stored into memory

    回答2

    Every encoding has a particular charset associated with it, but there can be more than one encoding for a given charset. A charset is simply what it sounds like, a set of characters. There are a large number of charsets, including many that are intended for particular scripts or languages.

    However, we are well along the way in the transition to Unicode, which includes a character set capable of representing almost all the world's scripts. However, there are multiple encodings for Unicode. An encoding is a way of mapping a string of characters to a string of bytes. Examples of Unicode encodings include UTF-8, UTF-16 BE, and UTF-16 LE . Each of these has advantages for particular applications or machine architectures.

  • 相关阅读:
    poj 3176 三角数和最大问题 dp算法
    poj 2236 网络连接问题 并查集
    poj 3614 奶牛美容问题 优先队列
    得时无怠
    Android入门(一)
    javascript之apply和call
    写一份面试答卷
    拿来即用的loading效果
    关于回调的唠叨
    Nodejs Guides(四)
  • 原文地址:https://www.cnblogs.com/chucklu/p/14638222.html
Copyright © 2011-2022 走看看