Answer the question
In order to leave comments, you need to log in
Objective-c qr-code encoded cp1251, how to convert to UFT8?
Good afternoon.
I am developing an application with the ability to read qr-code. Faced a problem when characters in cp1251 encoding were encoded in ar-code.
I take the string from ar-code like this
NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *)current stringValue];
NSData *dt = [scannedResult dataUsingEncoding:NSWindowsCP1251StringEncoding];//dt = nil
scannedResult = [[NSString alloc] initWithData:dt encoding:NSUTF8StringEncoding];
NSData *dt = [scannedResult dataUsingEncoding:NSUTF8StringEncoding];//dt с байтами
scannedResult = [[NSString alloc] initWithData:dt encoding:NSUTF8StringEncoding];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question