0

I am trying to understand about Encoding, as far i know utf-8 encode mean it t uses 8-bit blocks to represent a character.

NSString *NSUTF8Encoding = [[NSString alloc]initWithCString:"String" encoding:NSUTF8StringEncoding];

NSString *NSUTF16Encoding = [[NSString alloc]initWithCString:"String" encoding:NSUTF16StringEncoding];

NSLog(@"NSUTF8StringEncoding :%@",NSUTF8Encoding);

NSLog(@"NSUTF16StringEncoding :%@",NSUTF16Encoding);

its say : Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future

what does it mean?

Thanks in advance.

Dharmesh Mansata
  • 4,422
  • 1
  • 27
  • 33
  • [unicode.org: General questions, relating to UTF or Encoding Form](http://www.unicode.org/faq/utf_bom.html) – vadian Feb 07 '17 at 07:28

1 Answers1

-1
  • NSUTF8StringEncoding : An 8-bit representation of Unicode characters.
  • NSUTF16StringEncoding : An 16-bit representation of Unicode characters.

It relates to the amount of possible letters/numbers/symbols a character set can have. An 8-Bit character can only have 256 possible characters. Whereas a 16-bit can have 65,536.

Haroun SMIDA
  • 1,106
  • 3
  • 16
  • 32
  • So what is the very incorrect about it? Don't just vote down, explain why? – Haroun SMIDA Feb 07 '17 at 08:40
  • 1
    Basically everything. You don't know what `UTF8` is because you are mixing it up with ASCII. Both `UTF8` and `UTF16` can encode the entire Unicode character set, which is about 1,112,064 characters. That's because they are *variable-length encodings*. The 8 and 16 is not the number of bits per character. – Sulthan Feb 07 '17 at 09:11
  • @Sulthan what exactly mean of encoding? – Dharmesh Mansata Feb 07 '17 at 10:39