iOS中ASCII字符串转UTF8格式

iOS中ASCII字符串转UTF8格式,可调用下面这个方法:
-(NSString *)gb2312toutf8:(NSData *) data
{
   
   NSStringEncoding enc =             CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
    
    NSString *retStr = [[NSString alloc] initWithData:data encoding:enc];
    
    return retStr;
    
}
posted @ 2015-11-11 10:08  漫步彩云间  阅读(913)  评论(0编辑  收藏  举报