在UILabel中显示亚洲unicode字符串

在UILabel中显示亚洲unicode字符串

本文介绍了在UILabel中显示亚洲unicode字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在UILabel中显示亚洲unicode值

How can we show asian unicode values in UILabel

\ U2013 \ U00ee \ U2013 \ U00e6 \ U2013 \ U2202 \ U2013 \ U220f \ U2013 \ U03c0 \ U2013 \ U00ee \ U2013 \ U220f \ U2013 \ U03c0 \ U2013 \ U00aa \ U2013 \ U221e \ U2014 \ U00c5

\U2013\U00ee\U2013\U00e6\U2013\U2202\U2013\U220f\U2013\U03c0 \U2013\U00ee\U2013\U220f\U2013\U03c0\U2013\U00aa\U2013\U221e\U2014\U00c5

谢谢

推荐答案

我不确定什么特别是亚洲"关于该文本,

I'm not sure what is particularly “Asian” about that text,

  • U + 2013是一个破折号(–)
  • U + 00ee是小写的"i"带有抑扬符(î)
  • U + 00e6是ae的旧连字(æ)
  • U + 2202是偏微分(∂)的字符.

如果程序正在本地化(也就是说,该程序将以多种语言提供),则应将文本放在Localizable.strings文件中.当您在Xcode中创建这些文件之一时,它将自动以合适的编码(很可能是UTF16)进行保存,并将其包含在您的内置软件中.该文件具有以下格式:

If your program is being localised [that is to say that the program will be available in more than one language], you should put your text in a Localizable.strings file. When you create one of these files in Xcode, it will automatically be saved in a suitable encoding (most likely UTF16), and it will be included in your built software. The file has the following format:

 "Base language text" = "Translation text";
 "Good evening!" = "こんばんは";

您可以使用以下语言引用翻译版本:

You can reference the translations using:

NSString *goodEvening = NSLocalizedString (@"Good evening!", @"An interjection said during the latter part of the day.");

此功能将根据用户在iPhone或Mac上选择的区域设置,自动将字符串转换为软件具有的任何可用的本地化版本(通过搜索适当的Localizable.strings文件).如果找不到合适的翻译,它将返回原始的基本语言字符串. NSLocalizedString的第二个参数用于提供翻译的上下文或含义,但不会包含在您的软件中.

This function will automatically translate the string into any available localisations that your software has (by searching for an appropriate Localizable.strings file), based on the user's chosen regional settings on their iPhone or Mac. If no suitable translation is found, it will return the original base language string. The second argument to NSLocalizedString is provided to give context or meaning to the translation, it does not get included in your software.

如果只想显示文本,则可以在NSString常量中包含Unicode代码点,但是必须使用小写的u(除非它们是32位代码点):

If you simply want to display text, you can include Unicode code points in NSString constants, but you must use a lowercase u (unless they are 32-bit code points):

NSString *myPunctuation = @"\u2013\u00ee"; // lowercase u
NSLog (@"%@", myPunctuation);

...

myPunctuation = @"\U00002013\U000000ee";  // uppercase U
NSLog (@"%@", myPunctuation);

这篇关于在UILabel中显示亚洲unicode字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 22:55