任务是 - 考虑西班牙语短语
"¡Aquí!"
在 ISO-8859-1 编码中它将有多少字节?UTF-8 有多少个?UTF-16 有多少个?UTF-32 有多少个?
我的解决方案是
- ISO 8859-1 = 6 bytes
- UTF-8 =8 bytes
- UTF-16 = 12 bytes
- UTF-32 = 24 bytes
那正确吗?
- ISO 8859-1 = 6 (6*1) (ISO 8859-1 is a single-byte encoding)
- UTF – 8 = 2+1+1+1+2+1=8 (1byte for ASCII character: A, q, u, ! are ASCII
characters (0 till 127), ¡ and í are 2 bytes each, their values are 161
and 237 correspondingly).
- UTF16 = 12 (6*2) (2 bytes for 0-FFFF (65535)
- UTF32 = 24 (6*4) (4 bytes for everything)