views:

189

answers:

2

Hi guys. i'm making an iphone application using some characters of spanish language. 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 extranges symbols. I try to solve this problem using for all text files UTF-8 enconder but no changes. Please... any idea?. Thanks a lot and regards, Cesar.

A: 

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.

John Calsbeek
+1  A: 

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.

Cesar Augusto Soto Caballero
4 is equivalent to `NSUTF8StringEncoding`, by the way, which you should use instead of its literal value.
John Calsbeek