一种是 0xCED2 52946
一种是 0x6211 25105哪种是正确的?为什么会有这两种的分歧?我用VC编写UNICODE程序时,得到"我"的UNICODE值是第二种:0x6211,我想得到第一种,该怎么办?

解决方案 »

  1.   

    一种是国标编码,就是gb2312,一种是unicode,第一个是gb的,第二个是ucs2的。
      

  2.   

    25105,我查了一下网上的unicode码表,都是这个值,不知道你的1值是哪得来的??
      

  3.   

    char *
    u2s( unsigned char *buf, unsigned short length, char *tmpbuf )
    {
    int i;
    char *p;
    char s[ 100 ] = "";
    wchar_t wstr[ 1 ];
    CString mstr; *tmpbuf = 0;
    mstr = _T( "" ); for( i = 0; i < ( int )length; i += 2 )
    {
    p = ( char * )wstr;
    *p = *( buf + 1 ); //high
    *( p + 1 ) = *buf; //low
    mstr = wstr;
    memset( s, 0, sizeof( s ) );
    strcat( s, ( const char * )mstr );
    if( *buf ) //if low is not 0
    {
    s[ 2 ] = 0;
    }
    else
    {
    s[ 1 ] = 0;
    }

    strcat( tmpbuf, ( const char * )s ); buf += 2;
    } return tmpbuf;
    }
      

  4.   

    //用法
    unsigned char a[ 10 ] = { 0x62, 0x11, 0 };
    char msg[ 10 ] = "";u2s( a, 2, msg );AfxMessageBox( msg );
      

  5.   

    0x6211是Unicode编码
    0xCE、0xD2是GB2312编码
      

  6.   

    jennyvenus 喜欢你的编程风格