How to read Chinese characters?
I have got a text file from th开发者_运维技巧e server and it contains Chinese characters. How to read these characters?
你好MD. 你会说中文吗?
You may want to take a look at CFStringConvertEncodingToNSStringEncoding
and kCFStringEncodingBig5_E
.
If you get it into the standard system encoding for NSString (I don't think you'll need to ever refer to UTF specifically) then anything that uses an NSString should work.
True that you might need to change the font to a different one, but the standard unicode system font should have chinese glyphs. They might be simiplified vs traditional though.
You need to know the encoding of that file. If it is Unicode, or you can convert it to Unicode, the iPhone will be able to handle it.
If you want to display it on the screen, you need proper fonts, which the iPhone also has.
If you want to understand what it says, you have to learn Chinese (or run it through a translator).
Hopefully, the server (if it's using HTTP) sends the encoding in the HTTP headers. Something like:
Content-type: text/plain; charset=UTF-8
Based on this encoding, you can read the text file in and display it properly.
精彩评论