Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在努力将NSString变量编码为 Euc-kr 类型... :( 我必须通信的数据库服务器基于 Euc-kr,所以我别无选择,只能这样做。
NSString
上面的答案几乎是正确的,但由于 EUC-KR 不是 NSString 编码,您首先必须从 CF 土地获取编码。像这样的东西:
NSUInteger encoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingEUC_KR); const char * eucKRString = [string cStringUsingEncoding:encoding];