how to decode UTF8 string in iphone

前端 未结 2 1914
面向向阳花
面向向阳花 2021-01-14 16:27

I want to decode an UT8 encoded string.

The input string is \"øæ-test-2.txt\"

and after decoding it should become \"øæ-test-2.txt

相关标签:
2条回答
  • 2021-01-14 16:58
    [NSString stringWithUTF8String:]
    
    0 讨论(0)
  • 2021-01-14 17:09

    I use this one.

    NSString *encoded_string = @"ü";
    const char *ch = [encoded_string cStringUsingEncoding:NSISOLatin1StringEncoding];
    NSString *decode_string = [[NSString alloc]initWithCString:ch encoding:NSUTF8StringEncoding];
    NSLog(@"%@",decode_String)
    
    0 讨论(0)
提交回复
热议问题