使用System.Text.Encoding.UTF8 这个class。

解决方案 »

  1.   

    首先你的表字段读进来是什么类型,string,还是byte[]
    如果是byte[],并且是以utf-8类型写入得,那么Encoding.UTF8.GetString(...);
    如果是string,Encoding.UTF8.GetBytes(...);
      

  2.   

    有一段把unicode转换为GB2312的代码,不知可否借鉴。 string unicodeString = "字符编码有多种方式,其中常用的有GB2312和UTF-8等等(\u03a0)"; // Create two different encodings.
    Encoding gb = Encoding.GetEncoding( "gb2312" );
    Encoding unicode = Encoding.Unicode; // Convert the string into a byte[].
    byte[] unicodeBytes = unicode.GetBytes(unicodeString); // Perform the conversion from one encoding to the other.
    byte[] gbBytes = Encoding.Convert(unicode, gb, unicodeBytes);
                
    // Convert the new byte[] into a char[] and then into a string.
    // This is a slightly different approach to converting to illustrate
    // the use of GetCharCount/GetChars.
    char[] gbChars = new char[gb.GetCharCount(gbBytes, 0, gbBytes.Length)];
    gb.GetChars(gbBytes, 0, gbBytes.Length, gbChars, 0);
    string gbString = new string(gbChars); // Display the strings created before and after the conversion.
    Console.WriteLine("Original string: {0}", unicodeString);
    Console.WriteLine("Ascii converted string: {0}", gbString);
      

  3.   

    到底想实现什么,在.NET中,不存在字符编码的问题,只有在涉及到输入输出的时候才存在。
      

  4.   

    将UTF8字符写入文件:WriteFile(System.Text.Encoding.UTF8.GetString("需要转换的字符串"));
      

  5.   

    HttpUtility
    用它
    用它
    用它
    用它
    用它
    用它
    用它
    还有 它:System.Text.Encoding.UTF8
      

  6.   

    输出到哪里?
    一般的来说,输出都使用输出流来实现的。设置StreamWriter的Encoding即可。
      

  7.   

    .net的字符串没有编码转换的问题,统一表示方式,只有特定的输入输出才可能需要转化成特定的编码,看你的需要了。