如何将string字符串转换成utf-8的?
谢谢

解决方案 »

  1.   


    using System.Text;byte[] buffer = Encoding.GetEncoding("utf-8").GetBytes("中国");
    string str = "";
    foreach (byte b in buffer) str += string.Format("%{0:X}", b);
      

  2.   

    using System.Text;byte[] buffer = Encoding.GetEncoding("utf-8").GetBytes("中国");
    string str = "";
    foreach (byte b in buffer) str += string.Format("%{0:X}", b);同意