创建GBK编码类型

NSStringEncoding gbkEncoding =CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000); NSString*pageSource = [[NSString alloc] initWithData:pageData encoding:gbkEncoding];
为什么可以这么处理?在NSString.h(按住command,双击NSStringEncoding即能查看),对NSStringEncoding的定义中,注释这么写着:
Note that in addition to the values explicitly listed below, NSStringEncoding supports encodings provided by CFString.
See CFStringEncodingExt.h for a list of these encodings.

 See CFString.h for functions which convert between NSStringEncoding and CFStringEncoding. 

 

 
 
posted @ 2018-03-27 10:50  刚刚888  阅读(259)  评论(0编辑  收藏  举报