Sergei on Tech

eInsights and then some

Sergei on Tech header image 2

Unicode characters in strings in xCode for iOS

July 1st, 2011 · No Comments

(back from the dead)

Spent about an hour trying to get an answer to a simple question. How do you add unicode characters to strings in xCode?

I thought Apple had an answer here. They were wrong though. I finally found what I was looking for on stackoverflow.
The trick is to use a unicode character in a string you need to write it as such:


“String\u2002with\u2003three\u2009different spaces”

So a unicode ensp U+2002 would be written as \u2002 in the code. Capitalization does matter, uppercase U means  there’s 8 hexadecimals following the U and u means there’s only 4 following the u.

Tags: iOS · Development

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment