Reputation: 8066
I have some texts
\u652f\u6301\u3002
I hope it can display the relevant unicode chars
I try to use
[s stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
to decode but no result
Welcome any comment
Upvotes: 0
Views: 221
Reputation: 3907
NSString *str =@"\u652f\u6301\u3002";
NSLog(@"%@",str); // Output: 支持。
NSString *str =@"\\u652f\\u6301\\u3002";
NSLog(@"%@",str); // Output: \u652f\u6301\u3002
Upvotes: 1
Reputation: 2115
I'm not totally sure of what you are trying to do. but in Ruby I could do the following.
ruby> a = Iconv.iconv( "UTF-8", "UTF-16LE","\\u652f\\u6301\\u3002")
=> ["\347\225\234\343\224\266\346\230\262\347\225\234\343\214\266\343\204\260\347\225\234\343\200\263\343\210\260"]
ruby> puts a
畜㔶昲畜㌶畜〳㈰
hope this helps.
Upvotes: 0