3 ms·
The only modern language that gets it right is Swift: Apple did a fairly good job with unicode string handling starting in Cocoa and Objective-C, by providing
by zackmorris 3y ago
The only modern language that gets it right is Swift:
Apple did a fairly good job with unicode string handling starting in Cocoa and Objective-C, by providing methods to get the number of code points and/or bytes:
https://stackoverflow.com/questions/15582267/cfstring-count-of-characters-not-code-points-in-a-string/15582268#15582268 https://stackoverflow.com/questions/15582267/cfstring-count-...
I feel that this support of both character count and buffer size in bytes is probably the way to go. But Python 3 went wrong by trying to abstract it away with encodings that have unintuitive pitfalls that broke compatibility with Python 2:
https://blog.feabhas.com/2019/02/python-3-unicode-and-byte-strings/ https://blog.feabhas.com/2019/02/python-3-unicode-and-byte-s...
There's also the normalization issue. Apple goofed (IMHO) when they used NFD in HFS+ filenames while everyone else went with NFC, but fixed that in APFS:
https://unicode.org/faq/normalization.html https://unicode.org/faq/normalization.html
https://medium.com/@sthadewald/the-utf-8-hell-of-mac-osx-feef5ea42407 https://medium.com/@sthadewald/the-utf-8-hell-of-mac-osx-fee...