+ 1
¿What is the difference between the character sets UTF-8, UTF-16, ASCII and ANSI? And ¿what's better?
¿cuál es la diferencia entre los carácter sets UTF-8, UTF-16, ASCII y ANSI? Y ¿cuál es mejor?
3 Antworten
+ 4
Different encoding. UTF8 requires a minimum of 1 byte in memory to encode a unicode character. UTF16 requires a minimum of 2. UTF32 requires 4 bytes. 8 and 16 are variable width. Each can take up to 4 bytes but use a minimum of 1 or 2 respectively. This means that the unicode code points from 0 to 127 will take a single byte in UTF8. 128 and up require 2 or more. Since the ASCII characters are the first 127, it is only compatible with UTF8.
ANSI only uses 1 byte. Period. It has pretty severe limitations and as such has been replaced by UTF8. Aside from ANSI I wouldn't say one is better than the others. Only that they are different and each could be used in different circumstances. Know your tools and pick the one that works best for your use case.
+ 6
If you are a webdeveloper you will be using unicode (utf-8) for everything.
utf-16 is common if you are in the business of parsing raw unicode.
ANSI is a colloquial name for the Windows-1252 encoding and it is mostly found on older european/american windows systems (but windows 10 aswell). You probably don't have to deal with it on the web.