Monday, April 30, 2012 [Tweets] [Favorites]

UTF-8 Everywhere

Pavel Radzivilovsky, Yakov Galka, and Slava Novgorodov (via Hacker News):

UTF-16 is the worst of both worlds—variable length and too wide. It exists for historical reasons, adds a lot of confusion and will hopefully die out.

Portability, cross-platform interoperability and simplicity are more important than interoperability with existing platform APIs. So, the best approach is to use UTF-8 narrow strings everywhere and convert them back and forth on Windows before calling APIs that accept strings.

If you’re a Cocoa programmer, be sure you’re familiar with -[NSString rangeOfComposedCharacterSequenceAtIndex:].

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment