views:

63

answers:

1

Hi,

So I can't seem to find good documentation that will allow me to do the following:

I've got a bunch of UTF8 strings JSON'ed down to my iphone app and displayed into the UITableView. When the user click on an item, I want a UIActionSheet to come up to notify them of the category that they've selected.


alt text


Problem is is that the Chinese Characters shows up in the UITableView no problem, but it shows up as UTF8 characters in the UIActionSheet. Is there any way to convert it from UTF8 into traditional chinese characters?

I'm trying to do it like this but it's not working:

const char *subCatName = [[thirdParamStringArr objectAtIndex:1] UTF8String];
    NSString *subCatSelectedConverted = [[NSString alloc] initWithUTF8String:subCatName];       

    NSString *actionSheetTitle = [@"You have selected " stringByAppendingString:subCatSelectedConverted];

    NSString *actionSheetTitleFinal = [actionSheetTitle stringByAppendingString:@", proceed to upload to selected subcategory?"];

    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:actionSheetTitleFinal delegate:self cancelButtonTitle:@"Proceed to Upload" destructiveButtonTitle:@"Cancel" otherButtonTitles:nil];

Thanks in advance!

+1  A: 

Ok, after further investigation this did the trick:

NSString *subCatSelectedName = [[thirdParamStringArr objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];


        NSString *actionSheetTitle = [@"You have selected '" stringByAppendingString:subCatSelectedName];

        NSString *actionSheetTitleFinal = [actionSheetTitle stringByAppendingString:@"', proceed to upload to selected subcategory?"];

        UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:actionSheetTitleFinal delegate:self cancelButtonTitle:@"Proceed to Upload" destructiveButtonTitle:@"Cancel" otherButtonTitles:nil];

This did the trick:


alt text

chimgrrl