iphone-common-codes-ccteam源代码 CCEncoding.h

本文深入解析了CCEncoding.h文件,详细介绍了如何在iOS开发中进行字符编码转换,包括从Unicode到UTF8、UTF8到Unicode、GB18030到Unicode等操作,并提供了相应的API实现。
// // CCEncoding.h // CCFC // // Created by xichen on 11-12-18. // Copyright 2011 ccteam. All rights reserved. // #import <Foundation/Foundation.h> // "陈曦" 的unicode编码为: // 0x48 0x96 0xE6 0x66 // UTF8编码为: // 0xE9 0x99 0x88 0xE6 0x9B 0xA6 // GB18030编码为: // 0xB3 0xC2 0xEA 0xD8 @interface CCEncoding : NSObject { } // log all encodings + (void)logAllEncodings; // unicode ---> UTF8 + (const char *)UnicodeToUTF8:(NSString *)src; // UTF8 ---> unicode + (NSString *)UTF8ToUnicode:(const char *)src; // GB18030 ---> unicode + (NSString *)GB18030ToUnicode:(const char *)src; // unicode ---> GB18030 + (const char *)UnicodeToGB18030:(NSString *)src; // GB18030 ---> UTF8 // GB18030 --> Unicode --> UTF8 + (const char *)GB18030ToUTF8:(const char *)src; // UTF8 ---> GB18030 // UTF8 --> Unicode --> GB18030 + (const char *)UTF8ToGB18030:(const char *)src; // Unicode cStr to Unicode NSString // you should make sure the cStr begins with 0xFF, 0xFE(the unicode flag). + (NSString *)UnicodeCStrToUnicode:(const char *)cStr withLen:(int)len; @end


googlecode链接地址(会有更新):http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCEncoding.h

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值