iPhone - 将 NSString 编码从 WindowsCP1251 转换为 UTF8
如何将 NSWindowsCP1251StringEncoding 转换为 UTF-8? 我进行了多次尝试,但没有人能达到应有的效果。我的最后一次尝试是:
NSData *dt = [mystr dataUsingEncoding:NSUTF8StringEncoding];
NSString *str = [NSString alloc] initWithData:dt encoding:NSWindowsCP1251StringEncoding];
str
的结果不可读。有人遇到过类似的事情吗?
how can I have this conversion from NSWindowsCP1251StringEncoding
to UTF-8
?
I had several attempts but no one worked as it should. My last try was:
NSData *dt = [mystr dataUsingEncoding:NSUTF8StringEncoding];
NSString *str = [NSString alloc] initWithData:dt encoding:NSWindowsCP1251StringEncoding];
The result of str
is unreadable. Did anyone encounter anything similar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你是如此接近:
I think you were so close: