3 ms·
I was sloppy in using the word "character" - strings are really sequences of codepoints. I've edited my post to reflect this. Of course, multiple codepoints may
by nneonneo 10y ago
I was sloppy in using the word "character" - strings are really sequences of codepoints. I've edited my post to reflect this. Of course, multiple codepoints may be needed to construct a single character, and that's by design.
- tannhaeuser 10y agoBut has Python 3 Unicode-aware string-length rather than byte-length functions (+ substring, case-folding, character classification functions etc.) for dealing with this? If it hasn't then nothing really is achieved for the general case by switching to 4-byte or any other fixed-byte unit, including the case of dealing with HTML 5 text. See also perlgeek's question.
- jnbiche 10y agoYes, Python 3 does have Unicode-aware functions, as demonstrated in the post (via slices). Go and Rust also have very good Unicode support, in addition to Swift and (apparently) Perl 6 as mentioned above.