UCS-4 などの調査 - Scheme VM を書く

バイト列を見ずして何が分かるものか。

ascii で abc

sewashi% echo "abc" > /tmp/sample.ascii
sewashi% od -x /tmp/sample.ascii
0000000 6261 0a63
0000004

utf32。
1文字4byteだ。

sewashi% iconv -f ASCII -t UTF32LE /tmp/sample.ascii > /tmp/sample.utf32
sewashi% od -x /tmp/sample.utf32
0000000 0061 0000 0062 0000 0063 0000 000a 0000
0000020

utf8は?。
教科書どおり ascii の範囲は ascii と全く同一。

sewashi% iconv -f ASCII -t UTF8 /tmp/sample.ascii > /tmp/sample.utf8
sewashi% od -x /tmp/sample.utf8
0000000 6261 0a63
0000004