Japanese and chinese characters in ios

2019-09-18 23:24发布

I just had an error, at least different in Xcode. I tried to put support for another language in a few sentences of the app, when the user chooses to change the language the app accesses just another index of NSArray. What happens is that one of the languages ​​is Japanese, and ran a few sentences, others simply returned me the following:

 (
    "\U5f62\U5f0f",
    "\U9023\U63a5\U5230\U5176\U4ed6\U5730\U65b9",
    "\U884c\U674e\U8a8d\U9818",
    "\U9322"
)

The original NSArray was:

JapaneseTableTitles = [[NSArray alloc]initWithObjects:@"あなたが聞こえます",@"便利なフレーズ",@"語彙",@"対話",@"情報", nil];

1条回答
叛逆
2楼-- · 2019-09-19 00:18

Are you NSLogging it? This is correct, as those are simply the Unicode code points of the Japanese/Chinese characters. If you do present those NSString in the UI (e.g. in a UILabel) they should appear correctly.

"\U5f62\U5f0f" = "形式"
"\U9023\U63a5\U5230\U5176\U4ed6\U5730\U65b9" = "連接到其他地方"
"\U884c\U674e\U8a8d\U9818" = "行李認領"
"\U9322" = "錢"
查看更多
登录 后发表回答