除几个特别的字母外,ANSI编码的低字节都可以用866编码的字节加上一个偏移量来得到,下面是一个简单的C语言实现:
unsigned char ru2ansi(unsigned char rch)
{
if(rch >= 0x80 && rch <= 0x85)
return(rch + 0x21);
else if(rch >= 0x86 && rch <= 0x9f)
return(rch + 0x22);
else if(rch >= 0xa0 && rch <= 0xa5)
return(rch + 0x31);
else if(rch >= 0xa6 && rch <= 0xaf)
return(rch + 0x32);
else if(rch >= 0xe0 && rch <= 0xef)
return(rch + 0x02);
else if(rch == 0xf1)
return(0xd7);
else
return(rch);
}
文章评论(0条评论)
登录后参与讨论