请问:aspx 接收到来自 asp from提交的string 字符串,在aspx里怎么把string 转成 UTF8变码?

解决方案 »

  1.   

    public static void PrintCPBytes(string str, int codePage)
       {
          Encoding targetEncoding;
          byte[] encodedChars;      // Gets the encoding for the specified code page.
          targetEncoding = Encoding.GetEncoding(codePage);      // Gets the byte representation of the specified string.
          encodedChars = targetEncoding.GetBytes(str);      // Prints the bytes.
          Console.WriteLine
                   ("Byte representation of '{0}' in Code Page  '{1}':", str, 
                      codePage);
          for (int i = 0; i < encodedChars.Length; i++)
                   Console.WriteLine("Byte {0}: {1}", i, encodedChars[i]);
       }