日语和中文字符在ios [英] Japanese and chinese characters in ios

查看:138
本文介绍了日语和中文字符在ios的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是有一个错误,至少在Xcode不同。
我试图在应用程序的几句话中支持另一种语言,当用户选择更改语言时,应用程序只访问NSArray的另一个索引。
发生的情况是,其中一种语言是日语,并且运行了几句话,其他语言只是简单地返回给我如下:

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

原来的NSArray是:

  JapaneseTableTitles = [[NSArray alloc] initWithObjects:@あなたがこえます,@便利なフレーズ,@语汇,@対话,@情报,nil] 

解决方案

NSLog ging it?这是正确的,因为那些只是日语/汉字的Unicode代码点。如果你在UI中呈现这些NSString(例如在UILabel中),它们应该会正确显示。

 \U5f62\ U5f0f=形式
\U9023\U63a5\U5230\U5176\U4ed6\U5730\U65b9=连接到其他地方
\U884c\ U674e\U8a8d\U9818=行李认领
\U9322=钱


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];

解决方案

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" = "錢"

这篇关于日语和中文字符在ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆