4 ms·
D was initially designed (around 2000) to be agnostic about UTF8, UTF16, and UTF32. The language has full support for all three. But it gradually became clear
by WalterBright 5y ago
D was initially designed (around 2000) to be agnostic about UTF8, UTF16, and UTF32. The language has full support for all three.
But it gradually became clear that UTF8 predominates.
D best practice now is to do all processing in UTF8. When encountering UTF16 or UTF32, promptly convert it to UTF8, do the processing, and then convert to UTF16 or UTF32 on output. In practice, the only time this is needed is to interface with Windows.
All the D standard library code that interfaces with Windows converts to/from UTF8 to UTF16.
If I was doing a do-over for D, there wouldn't be core language support for UTF16 or UTF32, only library support.
- ChrisSD 5y agoUTF-32 was an interesting choice. Was that done for the sake of completeness or was there a specific use case for it?
- WalterBright 5y agoIt was done for completeness. I was accused of being an anglophile at one point for not doing everything in UTF-32 :-)