French characters in SQLite..how to display properly in iPhone app? - iphone

I am working on an iPhone app using a SQLite db. I have some French characters that are not rendering properly in the app - they are being displayed as squares.
The character set client is: utf8. Is there an easy fix for this?

Check that everything is using UEF8, including the database, table and row. Try using some of the sample code with French characters.
You can use SQLiteManager to see how your database was created and whether it's using UTF8.

Actually, the font I was using did not render those characters correctly! Problem solved!
Check your fonts!

Related

Unicode character change after retrieving from server in iPhone

I have an iPhone application in which I am sending text in an UITextview to a server through a web service. and in the next page I am displaying the list of comments from the server through the web service. Everything is working fine except when I insert emoji/emoticons in the UITextview.
The next page displays square boxes instead of some emoji character (not all).
I have noticed that:
Working: I have inserted one emoji character in UITextview from an emoji keyboard and printed its code in log, \u2601, and submitted this text to the server. In the next page I got the same unicode \u2601 and it's working fine. It shows me the emoji icon.
Not Working: Now I have inserted another emoji character in the UITextview from the emoji keyboard and printed its code in log, \ud83d\udc16, and submitted this text to the server. In the next page I got a unicode codepoint which is different from what I sent: \uf416. iPhone doesn't recognize this unicode so it gives me a square box.
So what is the problem here? It's not working only when the emoji character has a pair of unicode codepoints.
The database in which the comment is stored is MySQL version 5.5.
Why does the emoji character code pair change when retrieved from the server? How to decode the retrieved Unicode into its original form so iPhone can recognize it?
The character U+F416 is in one of the Private Use Areas (PUA).
Likely, some code on the way from the app to the database and back replaced the emoji with this character. This could be any of the components on this way, e.g. the client library tha you use to communicate with the service, the web service, the database interface, or the database itself. Try to tackle each of this layers individually, or follow the character through the layers to check whether it is still correct.
Thanx Mar Byers, You gave me hint. I have read what is Unicode planes and what is surrogates and how it works. I have found that that is no server problem actually, because my SQL server version is 5.5 that has character set uyf8mb4, i have used that set in Comments column.
Now the problem with SBJSON that i used in my app to decode json response geting from server.SBJSON decode that surrogate pair(UTF16 UTF16) in one unicode UTF16, and thats why the emoji with surrogate pair is not displayed. Apple introduce json library NSJSONSerialization for ios5 and later os. I used that library to decode json response and my code work like charm..:)
I have got solution from here
http://blog.manbolo.com/2011/12/12/supporting-ios-5-new-emoji-encoding
and here
http://blog.manbolo.com/2012/10/29/supporting-new-emojis-on-ios-6
thanx to #Manbolo Blog.

UTF8 iPhone can't read amharic letters

It has suddenly happened that I need to output a couple of strings in amharic (ethiopian) and some quite exotic (I think tamil if in Cambodia they use it). I store these strings in DB and they look fine -> (ሳንቲም).
After retrieving them from db with:
currObj.originalUnitName=(originalUnitName)?[NSString stringWithUTF8String:originalUnitName]:#"";
I am getting in device nice squares only which imho means iPhone has no proper decoder. Is there any solution for this case?
P.S I am using iOS 5.1
Thank you in advance.
You have to use special font that provides these characters. "Abyssinica SIL" (http://software.sil.org/abyssinica/download/) worked in my case.
What font are you using to output the NSString?
There's number of fonts in iOS without a proper UTF8 support. (e.g. Helvetica Neue)
I suggest you to perform further tests with standard Helvetica, which is (almost) fine.

Character convert ion for Spanish characters in iPhone

I am writing an iPhone app, and I am consuming web services to get some info. This info is UTF-8 encoded, but some Spanish special characters are shown in a strange way (for instance, Ó is shown as Ó).
How could I convert them?
Thanks.
Check this solution ,it may help:
Spanish character encoding - iphone
Greetings from another spaniard!

how do I specify a system font that handles wide characters on the iphone?

This is sort of a generic question due to my lack of experience with fonts, so a little patience and/or pointing in the right direction to get more info would be appreciated. I have an iphone app and am noticing that when I print some text on my labels, I end up with garbage when the string contains non-ascii, like Korean for example.
My guess is that since my UILabels, for instance, are using the system font, perhaps the system font does not support displaying wide characters. However, I'm left with a few beginner questions:
1) How do I set the system font so my iphone sdk objects that use the system font use it?
2) Does this sound correct that the system font probably doesn't support wide characters and is the reason I see garbage when I have characters out of the normal ascii range?
Thanks. Let me know if I need to clarify the problem please.
Update:
I later suspected maybe it was a problem on my server end so posted this related but not identical post here: does google app engine display unicode differently in StringProperty v StringListProperty objs?
It turns out the problem was not with the font, but with improperly encoding the data response from the server into Ascii when I should have used UTF8. It appears the font supported unicode to begin with.

iPhone - How to load Chinese text

I have a file with Chinese text that I want to use in my XCode project (I'm planning to load it through a database as it is lot of text), the problem is I don't know how to add the font to my project so that it's viewable when used on an iPhone?
Thanks :)
I currently live in China and deal with this all of the time. Usually the problem is not the font, it's the way the characters are represented. All unix variants use UTF-8 (most OSes) Windows uses UTF-16/32 (I forget). The cool thing about UTF-8 is that it is backward-compatible with ASCII. Open your text in the TextEdit or Firefox. In Firefox you can tell the browser to try different encodings, then save it to a file. If it is the wrong encoding, Mac TextEdit can convert between UTF-8 and UTF-16. Once you have the string in UTF-8 encoding, you can display it in your text field.
When displaying text to a textfeild make sure to display a UTF-8 string, not an ASCII string.
If you are interested in the details of UTF-8, just say so and I will expand on the UTF-8 design.
rw
The iPhone already has chinese fonts installed by default.
I've had some success using the FontLabel library. It allows you to use arbitrary .ttf fonts in your app and it's Apache-licensed:
http://github.com/zynga/FontLabel
For the majority of cases this has worked perfectly for me.