Since you understand Unicode so well, can you explain dietrichepp's theory that Unicode don't need counting or offsets?Unicode doesn't have "characters." If you talk about characters, all you've succeeded in doing is confusing yourself. Leave characters back in ASCII-land where they belong.
Counting code points is stupid. If you like counting code points, go sit in the corner. You don't understand unicode.
You can count graphemes, but it's not going to be easy. And most of the time, I don't see why you would need to do that.
And why UCS4 (Not variable-length) is chosen in many Unicode implementations? Why wchar_t is always 32bit in posix?
wchat_t is a horrible abomination that begs for death. Nobody should use it. Use UTF-8 instead. I think Python used to use UCS4, but they don't any more. It's a horrible representation because all your strings bloat up by 4x.