给个地址,可能有帮助
http://users.erols.com/eepeter/chinesecomputing/wwwboard.htmlsearch ucs2 in it

解决方案 »

  1.   

    要查编码,去下面找找
    http://www.unicode.org/
      

  2.   

    http://www.gsm-modem.de/ucs2.html
    http://www.unicode.org
      

  3.   

    查看了一下内存,“生日快乐”是这样的(十进制):
    UCS-2: 31 117 229 101 235 95 80 78 
    GB:   201 250 200 213 191 236 192 214 
    很明显,手机的UCS2编码字符串跟WINDOW的正好高低位调转了。
      

  4.   

    (已经好久没用。NET了,所以用DELPHI)//先高低位互换
    for i:=0 to iLen do
      Wide_Char[i]:=WideChar(Buffer[i*2]*256+Buffer[2*i+1]);
    Wide_String:=Wide_Char;
    //Ucs2->Gb2312
    Ansi_String:=Wide_String;
      

  5.   

    生:ucs-2为117 31
    但还是得不到gb呀
      

  6.   

    byte[] a={31,117,229,101,235,95,80,78};
    byte[] b={117,31,101,229,95,235,78,80}; 
    string msg=Encoding.Default.GetString(a);
    Console.WriteLine(msg);
    msg=Encoding.Default.GetString(b);
    Console.WriteLine(msg);
    结果:
    u錯隷PN
    ue錩隢P
      

  7.   

    Dim bContent As Byte() = {31, 117, 229, 101, 235, 95, 80, 78}
            Dim S As String
            S = Encoding.Unicode.GetString(bContent)
            Response.Write(S)结果:生日快乐
      

  8.   

    /// <summary>
    /// 从ucs2转换到gb2312
    /// </summary>
    /// <param name="ucs2">ucs2编码数据</param>
    /// <param name="gb2312">gb2312数据</param>
    /// <returns></returns>
    public static int UCS2ToGB2312(ref byte[] ucs2,int len)
    {
    int res=0;
    byte tmp;

    try
    {
    if(len%2==0 && len<=ucs2.Length)
    {
    int i=0;
    while(i<len-1)
    {
    tmp=ucs2[i];
    ucs2[i]=ucs2[i+1];
    ucs2[i+1]=tmp;
    i=i+2;
    }
    }
    else
    {
    res=0;
    }
    }
    catch(Exception e)
    {
    res=-1;
    throw(e);
    }
    return(res);
    }接下来用:
    msg=System.Text.Encoding.Unicode.GetString(ucs2);总算结了,经验如下:
    编程不能一个颈的往里想,其实有时就应该休息一下,等到头脑清醒后,再开始想!这样的效果往往要好得多!这也许就是为什么要休息的原因吧!