Created
October 30, 2013 14:19
-
-
Save ShonFrazier/7233460 to your computer and use it in GitHub Desktop.
Problem with encoding detection?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char *cString = "CHS - 中设置了私人内容文件夹 您可以随时访问此文件夹。.pdf"; | |
NSUInteger sLen = strlen(cString); | |
NSString *wrongString = [NSString stringWithFormat:@"%s", cString]; | |
NSLog(@"%@", wrongString); // CHS - 中设置了私人内容文件夹 您可以随时访问此文件夹。.pdf | |
NSString *rightString = [[NSString alloc] initWithBytes:cString length:sLen encoding:NSUTF8StringEncoding]; | |
NSLog(@"%@", rightString); // CHS - 中设置了私人内容文件夹 您可以随时访问此文件夹。.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment