How do I convert a NSString into TIS-620 encoded string
Posted
by MacPC
on Stack Overflow
See other posts from Stack Overflow
or by MacPC
Published on 2010-05-20T07:56:03Z
Indexed on
2010/05/20
8:00 UTC
Read the original article
Hit count: 245
In the apple document, I can see that there's a way to convert from UTF8 string to ASCII string like this
NSData *asciiData = [theString dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *asciiString = [[NSString alloc] initWithData:asciiData encoding:NSASCIIStringEncoding];
But my app requires a TIS-620 string to post to a site so I try to do the same thing
NSData *asciiData = [newPost.header dataUsingEncoding:kCFStringEncodingMacThai allowLossyConversion:YES];
NSString *asciiString = [[NSString alloc] initWithData:asciiData encoding:kCFStringEncodingMacThai];
NSLog(@"%@", asciiString);
The output I got is like this ???????????.
Does anyone know how to convert the NSString to TIS-620 properly? Thanks so much.
© Stack Overflow or respective owner