程序如下:
string s_name = "张三", s_no = "01";Response.write(s_name.Length);
Response.write(s_no.Length);返回结果都是2
怎么样才能让第一个结果为4
另外一个结果为2

解决方案 »

  1.   

    http://community.csdn.net/Expert/TopicView3.asp?id=5082630
      

  2.   

    编码的问题...Encoding.Default.GetByteCount(s);
      

  3.   

    String strTemp ="中華人民";
    System.Text.Encoding.Default.GetBytes(strTemp).Length
      

  4.   

    Encoding.Default.GetByteCount(s).Length
      

  5.   

    s_name.Length说明你的string有几个内容而已.具体占多少个字节要看你编码的状态.默认unicode码每个占2b