Setlocale In Ios Aka Swprintf In Ios Error Eilseq
when work with swprintf (or wchar functions),you probably want set locale to en_US.UTF-8,but in ios there is no en_US.UTF-8 locale,this is what you should to
How
- copy en_US.UTF-8 to your ios project resource path,and add to project
sudo copy -r /usr/share/locale/en_US.UTF-8/ your_ios_resource_path/en_US.UTF-8/
- set locale in AppController applicationDidFinishLaunchingWithOptions
NSString* resources = [ [ NSBundle mainBundle ] resourcePath ];
setenv("PATH_LOCALE", [resources cStringUsingEncoding:1], 1);
setlocale( LC_CTYPE, "en_US.UTF-8" );
- when format string use %ls instead
blog comments powered by Disqus