Unicode not converted when displayed - iphone

I'm localizing an app to spanish, and characters are encoded in the Localizable.strings file for that language using Unicode. For example, I have the entry: "login.saveSettings"="Guardar configuraci\\u00F3n:"; which is displayed in a UILabel exactly like that ("Guardar configuraci\\u00F3n:"), instead of "Guardar configuración:". I tried different variations, such as "\u00F3", or "\\U00F3", but without any success.
I use NSLocalizedString this way: self.saveSettingsLabel.text = NSLocalizedString(#"login.saveSettings", #"Save Settings:");
What am I doing wrong?
Thanks for any help!
Mihai

The correct variant is \U00F3 with 1 backslash and a capital U.

Related

DOXYGEN: Insert special characters in English output file

I'm generating a Doxygen file in English ( OUTPUT_LANGUAGE = English), but sometimes I need to include special characters of other languages (i.e. 'ñ', 'ö', etc. ). The problem is when using these characters, the generated file replaces these characters by unknown characters: �
So, how can include special characters in an English output Doxygen document?
Any suggestion? Thanks in advance
Eduardo
Thanks for your help
Changing INPUT_ENCODING to ISO-8859-1 fixes the problem.
Hope this helps

Displaying accents and other UTF-8 characters in a UILabel

I have a little app which lists the names of certain people from around the world, and some of those names use characters that are not normal ASCII characters, like DÌaz, or ThÈrËse for example.
The strings show up in Xcode just fine, but when I put them in a UILabel, they behave unexpectedly.
My question is: Is there a way to set up a UILabel to to take the exact string in Xcode, and display it properly, even if it is a UTF-8 character (or any other character encoding for that matter)?
UIKit fully supports unicode, your problem is most likely the encoding of the source file. You can set that in the inspector (Xcode 4: ⌘⌥1) under "Text Settings". Make sure it is UTF-8 as well.
Alternative: Use unicode escapes like #"\u2605" (should display ★).
Try to encode the String:
NSString *s = [NSString stringWithCString:value encoding:NSASCIIStringEncoding];

How do you add a macron to a character in an NSString? via Unicode?

Objective-C iOS Programming:
I need to display a number like 8.33333 just as 8.3, with the three having a macron (repeating number symbol, a bar line) above it. I have done some searching and have not found a solution to this. I have found the encoding for C/C++/Java source code being "\u0304" and for Unicode being "U+0304". Is there a way that I can create an NSString from a Unicode character? And how would a create a Unicode character with a macron?
Thanks.
For combining characters such as U+0304, the string should contain the original letter followed by the combining character. For instance,
NSString *str = #"ca\u0304t";
is a representation of cāt.

How to use Norwegian language iphone?

How can i use Norwegian characters to show them in UILabel in my application.
if i use it directly it shows garbage value.
The characters should work. I'm using a UILabel which loads from a nib file into the view of a ViewController. The label works in Times New Roman and Palatino (and presumably other fonts) when I set the text with the following code: [myLabel setText:#"ÆØÅ æøå"]; . I would try copying and pasting that line directly and see what happens.
I would guess that you're getting your characters from somewhere whose representation is not quite right in NSString terms. I grabbed these from Wikipedia. (I don't speak Norwegian so I'm not sure if you need other non-English alphabet characters - as far as I could see these were the only ones.)

iPhone Application in spanish using foreign characters

I'm making an iphone application using some Spanish characters. All of these characters are being included on a various text files. The matter is that when I import the data using NSMutableArrays or NSData objects, all the special characters was replaced for strange symbols. I try to solve this problem using for all text files UTF-8 enconder but no changes.
Thanks for the tip. I solved the problem. When we're working with spanish characters we need to implement the serializable object with the following method of NSString class:
(id)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error
You'll need to pass "enc". I used "4" and working for me. Regards.
Cesar.
Try using different encodings—using UTF-8 will only work if the text is actually in that encoding, which it apparently isn't. For example, try ISO Latin-1 or MacRoman.