Hello All,
I have a problem regarding Unicode characters. I'm able to append Apple Art Work Unicode Characters in UITextView.
Like this : -
self.textView.text = #"\ue00A";
It is Okay.
But now i have many Unicodes Characters which're not in Apple art work.
One of them is U+1F3C7
Now I'm trying to show it in UITextView.
self.textView.text = #"\u1f3c7";
Then it is showing me an Special Character instead of Emoji.
This is the Emoji Icon of this Unicode But it is showing me Ἴ7.
Apple doesn't support all Unicode Characters ?
How can I add my own emojies in my application ?
Let me know if my question is not clear for you.
Doesn't Objective-C use UTF-16 internally, like Java and C#?
If so, then U+1F3C7 wouldn't be "\u1f3c7", but the surrogate-pair, "\uD83C\uDFC7".
Otherwise, there has to be some way to indicate a higher character, because "\u1f3c7" is the same as "\u1f3c" + "7", which is Ἴ7 (capital iota with psili and oxia, then 7).
Edit: After some discussion between the OP and myself, we figured out that the way to do this in Objective C is one I know as the C++ way:
"\U0001F3C7"
(\uXXXX with a small u and 4 hex digits works if it fits in thos 4 hex digits, \UXXXXXXXX with a capital U and 8 hex digits works for everything, but is longer to type).
Now our friend just needs to deal with the matter of font support, which alas is another problem in getting this to actually look as he wants.
Related
I want to use emojis in my iOS and Android app. I checked the list of emojis here and it lists out the hex code for the emojis. When I try to use the hex code such as U+1F600 directly, I don't see the emoji within the app. I found one other way of representing emoji which looks like \uD83D\uDE00. When using this notation, the emoji is seen within the app without any extra code. I think this is a Unicode string for the emoji. I think this is more of a general question that specific to emojis. How can I convert an emoji hex code to the Unicode string as shown above. I didn't find any list where the Unicode for the emojis is listed.
It seems that your question is really one of "how do I display a character, knowing its code point?"
This question turns out to be rather language-dependent! Modern languages have little trouble with this. In Swift, we do this:
$ swift
Welcome to Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1). Type :help for assistance.
1> "\u{1f600}"
$R0: String = "😀"
In JavaScript, it is the same:
$ node
> "\u{1f600}"
'😀'
In Java, you have to do a little more work. If you want to use the code point directly you can say:
new StringBuilder().appendCodePoint(0x1f600).toString();
The sequence "\uD83D\uDE00" also works in all three languages. This is because those "characters" are actually what Unicode calls surrogates and when they are combined together a certain way they stand for a single character. The details of how this all works can be found on the web in many places (look for UTF-16 encoding). The algorithm is there. In a nutshell you take the code point, subtract 10000 hex, and spread out the 20 bits of that difference like this: 110110xxxxxxxxxx110111xxxxxxxxxx.
But rather than worrying about this translation, you should use the code point directly if your language supports it well. You might also be able to copy-paste the emoji character into a good text editor (make sure the encoding is set to UTF-8). If you need to use the surrogates, your best best is to look up a Unicode chart that shows you something called the "UTF-16 encoding."
In Delphi XE #$1F600 is equivalent to #55357#56832 or D83D DE04 smile.
Within a program, I use it in the following way:
const smilepage : array [1..3] of WideString =(#$1F600,#$1F60A,#$2764);
JavaScript - two way
let hex = "😀".codePointAt(0).toString(16)
let emo = String.fromCodePoint("0x"+hex);
console.log(hex, emo);
I am trying to represent the Amharic letter "ሀ" as this
let letter = "\u{1200}"
but when I run the app it gives me a question mark.
any one who knows how to represent unicode characters not supported by IOS in swift?
If the rendering of the character is the problem, make sure you use a font that is capable of that character.
If this is no duplicate, it's about the font, not swift or representation in code.
I need the copyright symbol like this 'ⓒ'. I did googling how to use this, and got the answer, Unicode \u00a9. But on some (Android) devices, it shows up bold. (I don't know how can explain... 'c' looks good but the circle around it looks bold.) So my colleague says to use \u24d2. Yes, it looks perfect on every device, but I don't know if it's proper. What's the difference between \u00a9 and \u24d2?
Unicode codepoint U+00A9 (©) is COPYRIGHT SIGN, and belongs to the "C1 Controls and Latin-1 Supplement" family of codepoints (U+0080 - U+00FF).
Unicode codepoint U+24B8 (Ⓒ) is CIRCLED LATIN CAPITAL LETTER C, and belongs to the "Enclosed Alphanumerics" family of codepoints (U+2460 – U+24FF), which includes all kinds of letters and numbers wrapped inside of circles, parenthesis, etc.
While U+00A9 and U+24B8 may visually appear to be similar, they are semantically very different things.
I'm trying to find a workaround to display old and rare characters in unicode using character combining. Currently I'm converting some dictionaries from EPWING into text and there are 36 different characters which cannot be reproduced using normal UTF-8. Below is the problem section of the epwing gaiji to unicode mappings for one of the dictionaries that I am converting, in some areas it has an interesting syntax that is clearly being used to combine characters in different ways. I was hoping if someone could identify what this syntax is, and where I might find documentation or a tutorial on how to use it.
s/<?w=b02a>/𡓦/g
s/<?w=b04b>/者/g
s/<?w=b064>/<⾱ 𤰇>/g
s/<?w=b077>/<彳<匕\/匕>>/g
s/<?w=b07c>/<山\/⺀>/g
s/<?w=b12e>/𥝝/g
s/<?w=b155>/</>/g
s/<?w=b156>/<\/>/g
s/<?w=b157>/<\/\/>/g
s/<?w=b158>/<こ[1]/と|ヿ>/g
s/<?w=b16f>/<㗢>/g
s/<?w=b170>/<㗥>/g
s/<?w=b171>/ଏ/g
s/<?w=b175>/lb/g
s/<?w=b22a>//g
s/<?w=b234>/ff/g
s/<?w=b25e>/㯌/g
s/<?w=b271>/<扌 晉>/g
s/<?w=b36b>/𣴴/g
s/<?w=b373>/𥝱/g
s/<?w=b42c>/𦼠/g
s/<?w=b434>/<已\/大>/g
s/<?w=b438>/𩸽/g
s/<?w=b43a>/𩺊/g
s/<?w=b43f>/<㇀/丶>/g
s/<?w=b440>/𠂆/g
s/<?w=b45a>/<?>/g
s/<?w=b45b>/<|>/g
s/<?w=b53d>/<?>/g
s/<?w=b53e>/<?>/g
s/<?w=b540>/<o>/g
s/<?w=b537>/<ト モ>/g
s/<?w=b541>/<一/𠔀>/g
s/<?w=b544>/<?>/g
s/<?w=b546>/<[r45]卐>/g
s/<?w=b55f>/*/g
I know that this line is supposed to represent 彳as a left vertical radical with one 匕 stacked on top of another 匕 as the right vertical portion of the character:
s/<?w=b077>/<彳<匕\/匕>>/g
This one is also pretty obvious, it's a 卐 rotated 45 degrees:
s/<?w=b546>/<[r45]卐>/g
Note: the four character hexadecimal codes that come after the ?w= is an identifier for the epwing gaiji that the unicode is supposed to correspond to.
Thank you for your time.
Please see The Unicode Standard section 12.2, Ideographic Description Characters. It discusses your precise situation.
Unfortunately, you may found that software support for what you are trying to do is practically non-existent.
I need a representation of µ or "micro". That funny small u with the long tail on the left side. Maybe you can see it here: µ
Some weeks ago I was reading in the docs, that it's a bad idea to type any special characters into the source code. So to prevent problems, could I encode that special character µ somehow like web folks do with , in an NSString? And if so, is there an overview of these codes or a way to get the correct code?
Take a look at this thread:
How do I escape a Unicode character in my Objective-C source code?
NSString *stuff = #"The Greek letter Beta looks like this: \u03b2"
For the iPhone, and for Mac OS X using the Xcode 3.x tool chain (targeting 10.2 or later, which you must be if you're using Xcode 3.x), it is safe and supported to use a literal µ in the string constant. The only caveat is that you must set the -finput-charset command-line option if your source files are not UTF-8 or UTF-16.