Last active
December 14, 2015 02:49
-
-
Save kazuho/5016636 to your computer and use it in GitHub Desktop.
文字列型を新設する場合についてサイズが重要ならば以下のような変態案もあります。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0xd6-MSB-terminated ASCII | |
0xd7-0xFF-terminated UTF-8 | |
"hello" => d6 68 65 6c 6c ef | |
"テスト" => d7 e3 83 86 e3 82 b9 e3 83 88 ff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MsgPackはタグを知らないと長さが分からないフォーマット(つまり non-TLV format)なのでターミネータという概念自体はそれほどの不整合を産まないと思います。
ただ、スキャンしないと長さがわからない、というのは、長い文字列を内部表現として UTF-8 を用いている環境においては問題になると思います(なので上記折衷案を併記した)。