开发者

Displaying non-roman characters in a string

开发者 https://www.devze.com 2023-02-16 09:10 出处:网络
In my app I receive from a remote host a string that is like this: \"01 - \\U00ab\\U00d开发者_运维问答3\\U00ba\\U00d2\\U00c2\\U00b4\\U00d5\\U00b7\\U00d5\\U00e8\\U00a4\\U00d2\\U00b9\\U00b7\\U00cd\\U00

In my app I receive from a remote host a string that is like this: "01 - \U00ab\U00d开发者_运维问答3\U00ba\U00d2\U00c2\U00b4\U00d5\U00b7\U00d5\U00e8\U00a4\U00d2\U00b9\U00b7\U00cd\U00a7 - \U00c8\U00d4\U00c3\U00d4\U00be\U00c3 \U00cd\U00d3\U00e4"

I know that this is a string in Thai language. When I display it using UILabel of NSLog, it shows up as:

01 - «ÓºÒ´շÕè¤Ò¹·Í§ - ÈÔÃԾà ÍÓä

Is there a way to make the string show up correctly using Thai font?

Thanks,


Shouldn't you be using something like

+ (id)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc

if you know what the specific encoding is and it is not UTF8, or

+ (id)stringWithUTF8String:(const char *)bytes

if that's what it is. Then the string should display. I expect the remote host says something about the encoding of the string in the response?

0

精彩评论

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