lynzz / BluetoothPrinter

7 stars 9 forks source link

Support encoding for Vietnamese #9

Open quanghuynh99 opened 6 days ago

quanghuynh99 commented 6 days ago

I tried but its not working:

- (void)setText:(NSString *)text{
    NSString *str;
    if ([text isKindOfClass:[NSNumber class]]) {
        str = [NSString stringWithFormat:@"%@", str];
    }else{
        str = text;
    }

    // NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(NSUTF8StringEncoding);
    NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
    [_printerData appendData:data];
}

Result printer after printed: original (Chào mừng đến với cordova) => (ߏߎߍߌߍߌ. ߍߏ ߍߌߌ cordova) idk this language 😂