用ANSI读出文本,然后用UTF-8输出就可以。

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/2539/2539409.xml?temp=.5053675
      

  2.   

    你可以参考一下System.Text.Encoding类,他提供了许多编码转换的形式
    其中Encoding.Convert方法可以满足你的需求。
    using System;
    using System.Text;namespace ConvertExample
    {
       class ConvertExampleClass
       {
          static void Main()
          {
             string unicodeString = "This string contains the unicode character Pi(\u03a0)";         // Create two different encodings.
             Encoding ascii = Encoding.ASCII;
             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[] asciiBytes = Encoding.Convert(unicode, ascii, 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[] asciiChars = new char[ascii.GetCharCount(asciiBytes, 0, asciiBytes.Length)];
             ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0);
             string asciiString = new string(asciiChars);         // Display the strings created before and after the conversion.
             Console.WriteLine("Original string: {0}", unicodeString);
             Console.WriteLine("Ascii converted string: {0}", asciiString);
          }
       }
    }
    详见MSDN:
    ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfSystemTextEncodingClassConvertTopic.htm
    ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfSystemTextEncodingMembersTopic.htm另外,在VB中,StrConv 函数也能执行其它字符串转换。例如,它把字符串从 Unicode 码转换到 ANSI 码,或进行反向转换。有关 StrConv 函数的详细信息,请在 Visual Basic 参考帮助的索引中搜索“StrConv 函数”。