5 ms·
Is utf-8 significant here, as opposed to the ASCII subset? It seems like it's an ASCII encoding, and it sorts like ASCII. I think that utf-8 sorting may depen
by chubot 9y ago
Is utf-8 significant here, as opposed to the ASCII subset? It seems like it's an ASCII encoding, and it sorts like ASCII.
I think that utf-8 sorting may depend on the locale. But here you're not depending on that -- you're just using the subset that is ASCII sorting, no?
- drostie 9y agoYes, this usage of UTF-8 is limited to the ASCII subset.
- chubot 9y agoRegarding the examples: " 0 " 1 # 42 Why is the length stored in base 92 while the number is stored in base 10? Why not just store them both in base 128 or 127 (if you want C strings)? You can't use base 256 because some strings won't be valid UTF-8, but base 127 or 128 seems fine. Do you want some notion of human readability? That isn't in the problem statement. Your problem statement seems fairly imprecise in a couple ways.
- drostie 9y agoI mean, I think a case can be made for something like it, where possibly one adds to the problem statement "the bytes should be contiguous ASCII and should not cause the JSON standard to backslash-encode the characters." The biggest range which does this is 0x23 to 0x5B inclusive. But that only gives 57 workable characters. If it helps, I am not the author of the original article.