gb2312的数字编码:
0->A3B0 1->A3B1 … 9 ->A3B9
对应的ASCII :
0->0x30 1->0x31 … 9->0x39
0-9数字编码 如何将gb2312转化为ascii demo如下
char roadline[] = {0xa3, 0xb2, 0xa3, 0xb0, 0xa3, 0xb2};
char conv_data[32];
int roadline_total_len = 6;
int i,t;
t = 0;
for(i = 0;i<roadline_total_len ;i+=2)
{
if(((roadline[i]&0xf0) == 0xa0) && ((roadline[i+1]&0xf0) == 0xb0))//确定是数字
{
conv_data[t] = ((roadline[i]&0x0f)<<4) | ((roadline[i+1])&0x0f);//取高低四位拼接
t++;
}
}
printf("%x %x %x\n",conv_data[0],conv_data[1],conv_data[2]);
//输出结果为 32 30 32