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
2010-01-06 16:37:27
+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
2010-01-08 17:41:02
4 is equivalent to `NSUTF8StringEncoding`, by the way, which you should use instead of its literal value.
John Calsbeek
2010-01-08 17:54:59