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!
Related
I building a app chat, and I come from Vietnam. But Input field in Unity dont show Vietnamese text. How I can get text from Input field is utf-8 text.
I'm not a native English speaker, so I'm sorry for every mistake.
I believe GUI in Unity uses UTF-16 and not UTF-8. You should be able to encode your file with UTF-16 in Monodevelop.
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.
I am using text to speech conversion API for iphone app.
When I pass on a text it responds with the audio data which plays the same text.
This works fine for english language.
But when I try and send a french word in request. It responds with an audio which repeats the same word 3 to 4 times.
What could be wrong?
It was an issue with the encoding of the data that I sent to the server.
Actually french language had some characters which needed to be encoded. So encoding those strings with UTF8Encoding did the trick.
Hope this helps someone. :)
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!
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.