如何在UIlabel中显示阿拉伯语文本 [英] How to display Text in Arabic in UIlabel

查看:292
本文介绍了如何在UIlabel中显示阿拉伯语文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从服务器获取此字符串作为回应,实际上是阿拉伯语
نريد& ;#1571;ننرىهذافي& ;#1575;للغةالعرب& ;#1610;ة



你可以在浏览器上看到阿拉伯语中的这个文本:نريدأننرىهذافياللغ العربية浏览器自动显示阿拉伯语文本。对于前我已经把代码标签,所以它显示代码...



现在我想用阿拉伯字体在UILabel上显示它,我该怎么做?



请帮助..



谢谢

解决方案

如果将服务器响应字符串中的每个4位文本数字十进制数转换为C int,则可以使用以下内容将每个字符转换为NSString:

  int c = ... / *你的4个文本数字unicode ordinal转换为整数* / 
charString = [NSString stringWithFormat:@%C, C ];

您可能还可以要求UIWebView运行一行Javascript并返回NSString。 / p>

I am getting this string from server in response, which is actually in arabic "نريد أن نرى هذا في اللغة العربية"

You can see this text in arabic on browser like this : نريد أن نرى هذا في اللغة العربية browser automatically shows text in arabic. for former i have put code tag so it is showing codes...

Now I want to show it on UILabel in arabic fonts, how would I do that?

Please help..

Thanks

解决方案

If you convert each 4 text digit decimal number in the server response string to a C int, then you can convert each character to an NSString using something like:

int c = ... /* your 4 text digit unicode ordinal converted to an integer */
charString = [ NSString stringWithFormat:@"%C", c ];

You might also be able to ask a UIWebView to run a line of Javascript and return an NSString.

这篇关于如何在UIlabel中显示阿拉伯语文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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