1

I used to be able to convert EUC japanese data into NSString by using the following code. The expected result is "目標". But I just tried to use IOS 8 simulator and the result is null.

const char bytes[]={0xcc, 0xdc, 0xc9, 0xb8};


NSData *d=[[NSData alloc] initWithBytes:bytes length:sizeof(bytes)];
NSString *s=[[NSString alloc] initWithData:d encoding:NSJapaneseEUCStringEncoding];

NSLog(@"%@",s);

Any one knows if this is a bug or something I failed to notice?

Chris
  • 11
  • 1
  • Assuming `bytes` really is a valid Japanese EUC string, then that looks perfectly valid to me and must be a bug in `NSString`. I would double and triple check the data is correct, and then file a TSI with Apple asking for help. https://developer.apple.com/support/technical/submit/ – Abhi Beckert Nov 03 '14 at 10:26
  • Please file a bug report at http://bugreport.apple.com – Jeremy Huddleston Sequoia Nov 03 '14 at 20:09
  • Filed a bug 18865187 with outputs on different versions. Let's see how it goes. – Chris Nov 04 '14 at 11:46

0 Answers0