swift-string

Why is unicode included as an Encoding in Swift's String API?

大兔子大兔子 提交于 2020-01-03 03:17:06
问题 I read this very important blog regarding string encodings. After reading it I realized that unicode is a standard of mapping characters to code points which are integers. How these integers are stored in memory is an entirely different concept. This is where .utf8 , .utf16 come into play, defining the way we store these integers in memory. In the Swift String API there is a method which gives us the data bytes used to represent the String in various encodings: func data(using encoding: