开发者

Inserting "£" in a string to a text file

开发者 https://www.devze.com 2022-12-22 17:42 出处:网络
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 c

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消