简体   繁体   中英

Seemingly unsupported unicode character in UILabel

I have a UILabel that displays a string coming in from a web service. It seems to be properly displaying some unicode characters, but not all. The string comes from the web service in a JSON object as follows:

"\⭑ \★ Special Chars"

This is displayed in the UILabel like so:

UILabel不一致的unicode支持

Clearly, it's displaying the \★ character just fine but not the \⭑ character. The font is Helvetica Neue --the system font.

Am I doing something wrong or is this a bug in iOS and/or the font?

This seems to be purely a font issue. The character U+2605 BLACK STAR “★” is relatively common in fonts, so it is probably taken from a system font or a fallback font. The character U+2B51 BLACK SMALL STAR “⭑” is relatively rare; it was added in Unicode 5.1, ie rather recently (in the character code world, that is). According to Fileformat.info data , it appears in Code2000, FreeSerif, GNU Unifont, Quivira, STIX, STIXMath, and Symbola. Not much; most computers have none of them (though many Linux systems probably have FreeSerif). Well, it seems that you can add Asana Math and Universalia to the list; still rather limited.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM