What. Unicode Encoding Equivalent in Objective-C?

What is equivalent in Objective-C.Net System.Text.Encoding.Unicode ? I tried:

  • NSUnicodeStringEncoding
  • NSUTF8StringEncoding
  • NSUTF16StringEncoding

None of the above characters returned the text correctly.

+5
source share
1 answer

According to http://msdn.microsoft.com/de-de/library/system.text.encoding.unicode.aspx , System.Text.Encoding.Unicode is the encoding of the small end of UTF-16. Equivalent NSString encoding NSUTF16LittleEndianStringEncoding .

NSUTF16StringEncoding almost the same, but it adds the Unicode (BOM) FF FE byte mark to the data. (And, strictly speaking, it is not documented that NSUTF16StringEncoding uses little-endian, so explicit NSUTF16LittleEndianStringEncoding should be used anyway.)

+9
source

Source: https://habr.com/ru/post/954995/


All Articles