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?
I think you were so close:
// Convert it back to CP1251
NSData *dt = [mystr dataUsingEncoding:NSWindowsCP1251StringEncoding];
// Now load it as UTF8
NSString *str = [NSString alloc] initWithData:dt encoding:NSUTF8StringEncoding];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With