3 ms·
The interesting character ranges are: U+0000 to U+007F: 1 byte for UTF-8, 2 for UTF-16 U+0080 to U+07FF: 2 bytes for UTF-8 and UTF-16 U+0800 to U+FFFF:
by jmillikin 17y ago
The interesting character ranges are:
U+0000 to U+007F: 1 byte for UTF-8, 2 for UTF-16
U+0080 to U+07FF: 2 bytes for UTF-8 and UTF-16
U+0800 to U+FFFF: 3 bytes for UTF-8, 2 for UTF-16
U+10000 and up: 4 bytes for UTF-8 and UTF-16
Arabic, Cyrillic (Russian), Tamil, Thai, Hebrew, and many other non-European scripts take an equal amount of space in either UTF-8 and UTF-16. Japanese and Korean have some cases where UTF-16 is more efficient, but only by a byte, and most Chinese characters take 4 bytes either way.
- pmjordan 17y agoAdditionally, since we're talking about web pages, the markup tags will still be composed of ASCII characters, for which UTF-8 has an advantage.