How to enter unicode characters in a UILabel in Interface Builder?

IphoneIosUnicodeUtf 8Interface Builder

Iphone Problem Overview


I would like to display a unicode character (the speaker symbol U+1F50A) in label. Is it possible to enter this symbol in Interface Builder?

Iphone Solutions


Solution 1 - Iphone

Yes, you can click "Edit" > "Special Characters…" — there you can find all unicode characters (including the emoji) and copy/paste them where you set the label text in Interface Builder.

EDIT: In Xcode 6 it's "Edit" > "Emoji & Characters"

Xcode 7+: "Edit" > "Emoji & Symbols"

Solution 2 - Iphone

For those who tried doing it programmatically, but failed, just use this:

label.text = @"\U0001F50A";

Solution 3 - Iphone

Do it programmatically.

Declare an IBOutlet for the Label, with the means of NSString type:

// UTF-8 Hexadecimal Encoding
NSString *myString = [NSString stringWithUTF8String:"0xF09F948A"];

myLabel.text = myString;

Also, take a look at https://stackoverflow.com/questions/8917215/unicode-in-button-title-in-xcode">this</a> question.

Solution 4 - Iphone

In Xcode 8/Swift 3 the easiest is to use the unicode escape:

let a = "\u{1F50A}"  

Solution 5 - Iphone

It's fun why few people knew this. You can enter Unicode-symbols directly by holding "Option" and entering hex digit. All you need: (Sierra example) goto "Preference -> Keyboards -> Input Sources" and search for "Unicode Hex". It should appears under "Others" section. Next add it and then you be able enter Unicode-char anywhere just selecting this input source.

For example: ✓ = (Alt+2713), € - (20ac), etc. Most interesting section from 2100 to 2800. Full list you can found here - Unicode table

P.S.: This method sutable only for four-digit Unicodes

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionragnariusView Question on Stackoverflow
Solution 1 - IphonegraverView Answer on Stackoverflow
Solution 2 - IphoneJohnVanDijkView Answer on Stackoverflow
Solution 3 - IphonePhillipView Answer on Stackoverflow
Solution 4 - IphoneleinadseyView Answer on Stackoverflow
Solution 5 - IphonesVdView Answer on Stackoverflow