[swift-evolution] Strings in Swift 4

Dave Abrahams dabrahams at apple.com
Sun Feb 5 22:15:46 CST 2017



> On Feb 5, 2017, at 2:57 PM, Ted F.A. van Gaalen <tedvgiosdev at gmail.com> wrote:
> 
> However, that is not the case with UTF-32, because with UTF-32 encoding
> each character has a fixed-width and always occupies exactly 4 bytes, 32 bit. 
> Ergo: the problem can be easily solved: The simple solution is to always 
> and without exception use UTF-32 encoding as Swift's internal 
> string format because it only contains fixed width Unicode characters. 

Those are not (user-perceived) Characters; they are Unicode Scalar Values (often called "characters" by the Unicode standard.  Characters as defined in Swift (a.k.a. extended grapheme clusters) have no fixed-width encoding, and Unicode scalar values are an inappropriate unit for most string processing. Please read the manifesto for details.

Sent from my iPad


More information about the swift-evolution mailing list