GB2312和Utf-8编码的转换[3]

字符转换码表

程序中用到的码表,定义在encoding.h文件中:


/************************************************************************
*
*  File name:                encoding.h
*
*  Description:                Convert character encoding between GB2312
*                              and Unicode(Utf-8).
*
*  Author:                    JiangPeifu
*  Creation date:            2009-02-20
*
************************************************************************/

/************************************************************************
 *     GB2312 to Unicode mapping
 ***********************************************************************/
const unsigned char  gb2uTable[] =
{
   0x30,0x00, 0x30,0x01, 0x30,0x02, 0x30,0xfb, 0x02,0xc9, 0x02,0xc7, 0x00,0xa8,
   0x30,0x03, 0x30,0x05, 0x20,0x15, 0xff,0x5e, 0x22,0x25, 0x20,0x26, 0x20,0x18,
   0x20,0x19, 0x20,0x1c, 0x20,0x1d, 0x30,0x14, 0x30,0x15, 0x30,0x08, 0x30,0x09,
   0x30,0x0a, 0x30,0x0b, 0x30,0x0c, 0x30,0x0d, 0x30,0x0e, 0x30,0x0f, 0x30,0x16,
   0x30,0x17, 0x30,0x10, 0x30,0x11, 0x00,0xb1, 0x00,0xd7, 0x00,0xf7, 0x22,0x36,
   0x22,0x27, 0x22,0x28, 0x22,0x11, 0x22,0x0f, 0x22,0x2a, 0x22,0x29, 0x22,0x08,
   0x22,0x37, 0x22,0x1a, 0x22,0xa5, 0x22,0x25, 0x22,0x20, 0x23,0x12, 0x22,0x99,
   0x22,0x2b, 0x22,0x2e, 0x22,0x61, 0x22,0x4c, 0x22,0x48, 0x22,0x3d, 0x22,0x1d,
   0x22,0x60, 0x22,0x6e, 0x22,0x6f, 0x22,0x64, 0x22,0x65, 0x22,0x1e, 0x22,0x35,
   0x22,0x34, 0x26,0x42, 0x26,0x40, 0x00,0xb0, 0x20,0x32, 0x20,0x33, 0x21,0x03,
   0xff,0x04, 0x00,0xa4, 0xff,0xe0, 0xff,0xe1, 0x20,0x30, 0x00,0xa7, 0x21,0x16,
   0x26,0x06, 0x26,0x05, 0x25,0xcb, 0x25,0xcf, 0x25,0xce, 0x25,0xc7, 0x25,0xc6,
   0x25,0xa1, 0x25,0xa0, 0x25,0xb3, 0x25,0xb2, 0x20,0x3b, 0x21,0x92, 0x21,0x90,
   0x21,0x91, 0x21,0x93, 0x30,0x13, 0xff,0xfd, 0xff,0xfd, 0xff,0xfd, 0xff,0xfd,
   0xff,0xfd, 0xff,0xfd, 0xff,0xfd, 0xff,0xfd, 0xff,0xfd, 0xff,0xfd, 0xff,0xfd,
   0xff,0xfd, 0xff,0xfd, 0xff,0xfd, 0xff,0xfd, 0xff,0xfd, 0x24,0x88, 0x24,0x89,
   0x24,0x8a, 0x24,0x8b, 0x24,0x8c, 0x24,0x8d, 0x24,0x8e, 0x24,0x8f, 0x24,0x90,
   0x24,0x91, 0x24,0x92, 0x24,0x93, 0x24,0x94, 0x24,0x95, 0x24,0x96, 0x24,0x97,
   0x24,0x98, 0x24,0x99, 0x24,0x9a, 0x24,0x9b, 0x24,0x74, 0x24,0x75, 0x24,0x76,
   0x24,0x77, 0x24,0x78, 0x24,0x79, 0x24,0x7a, 0x24,0x7b, 0x24,0x7c, 0x24,0x7d,
   0x24,0x7e, 0x24,0x7f, 0x24,0x80, 0x24,0x81, 0x24,0x82, 0x24,0x83, 0x24,0x84,
   0x24,0x85, 0x24,0x86, 0x24,0x87, 0x24,0x60, 0x24,0x61, 0x24,0x62, 0x24,0x63,
   0x24,0x64, 0x24,0x65, 0x24,0x66, 0x24,0x67, 0x24,0x68, 0x24,0x69, 0xff,0xfd,
   0xff,0xfd, 0x32,0x20, 0x32,0x21, 0x32,0x22, 0x32,0x23, 0x32,0x24, 0x32,0x25,
   0x32,0x26, 0x32,0x27, 0x32,0x28, 0x32,0x29, 0xff,0xfd, 0xff,0xfd, 0x21,0x60,
   0x21,0x61, 0x21,0x62, 0x21,0x63, 0x21,0x64, 0x21,0x65, 0x21,0x66, 0x21,0x67,

 

... ...

由于h文件过大,粘贴不全。

需要的友人可以发信索取。

email:jiangpeifu@gmail.com

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值