3 ms·
apple still uses utf16?
by NooneAtAll3 1y ago
apple still uses utf16?
- markasoftware 1y agois this talk about apple? Regardless, lots of language runtimes still use utf16 (eg java, qt, haskell), and windows certainly still uses utf16.
- zopa 1y agoNit, but if you're thinking of Haskell's text library, it's utf8 now: https://github.com/haskell/text/pull/365 https://github.com/haskell/text/pull/365
- markasoftware 1y agooh wow, I remember reading a blog post about how this effort wasn't going well a while ago. I guess it got through in the end!
- vanderZwan 1y agoJavaScript does, so the web does, so by extension Apple probably does care about utf16.
- jiggawatts 1y agoAlso: Java, DotNet, and Windows all use 2-byte char types.
- looperhacks 1y agoAkchyually! These days, Java uses Latin1 if no characters outside Latin1 are used. Only if full Unicode is necessary, it uses UTF-16
- josephg 1y agoApple does something similar for strings in objc and Swift. They do lots of other optimisations besides - like small string optimisation for short strings to avoid heap allocations.
- flohofwoe 1y agoNSString is UTF-16 internally: https://developer.apple.com/documentation/foundation/nsstring?language=objc https://developer.apple.com/documentation/foundation/nsstrin... ...it's trivial to get UTF-8 strings into and out of an NSString though so the internal representation doesn't matter all that much. More importantly, all of the actual user-facing side of macOS is UTF-8 (e.g. you can simply copy-paste an UTF-8 encoded UNICODE string literal into a C source file, printf() it and it will show up correctly on the terminal without tinkering with text editor or locale settings).