Inserting "£" in a string to a text file
iPhone Application writes data to a text file, saves it on the Documnets folder. Great that works
If I place "£" in the string, or use [currencyStyle stringFromNumber] the text file will not be created.
The "£" and the [currencyStyle stringFromNumber] works if the inform开发者_运维百科ation is printed to a "New View" page on the simulator, pound and all
Can someone please explain what's happening?
Make sure you're writing your string to the text file with the proper encoding. If you use the -writeToFile:atomically:encoding:error: method of NSString, you should pass NSUTF8Encoding as the encoding argument. You should not use the deprecated -writeToFile:atomically: method.
精彩评论