字符串编码转换Unicode->GB2312

        string uni = "\u7535\u4fe1";
        Console.Write(GetString(Encoding.Unicode, Encoding.GetEncoding("GB2312"), uni));

    
public static String GetString(Encoding source,Encoding dest,String soureStr)
    {
        
return dest.GetString(Encoding.Convert(source, dest,source.GetBytes(soureStr)));                           
    }
posted @ 2011-02-25 15:28  高凡凡高  阅读(563)  评论(0编辑  收藏  举报