要转换成gb2312
Encoding.GetEncoding("GB2312")

解决方案 »

  1.   

    to Tomgus(小桥流水) 
    试过System.Text .Encoding.GetEncoding("GB2312").GetBytes (strValue1,0,strValue1.Length ,bt,0);
    不行,连发都不行
      

  2.   

    private string GetMessage(string strValue)
    {


    string strTemp="";
    int iLen=0;
    Byte[] bt=new Byte [1024];
    Byte btTemp=new Byte();
    string strValue1=strValue;
    System.Text .Encoding .Unicode .GetBytes (strValue1,0,strValue1.Length ,bt,0);
    for(int i=0;i<bt.Length ;i=i+2)
    {
    if(bt[i]==0 && bt[i+1]==0)
    {
    iLen=i;
    i=bt.Length ;

    }
    else
    {
    btTemp=bt[i];
    bt[i]=bt[i+1];
    bt[i+1]=btTemp;
    }
    } strTemp=System.Text .Encoding .Default.GetString (bt,0,iLen);//!!!将此处改为System.Text .Encoding .Unicode.GetString(bt,0,iLen);
    return strTemp;

    }
      

  3.   

    to Edifier0709(忘掉地平线)
    这样的话发不出去
      

  4.   

    无论你怎样改这个函数都没有用,因为返回值都是Unicode编码的。
    改真正发送的那个程序。
      

  5.   

    带有中文的参数用System.Web.HttpUtility.UrlEncode()编码,接收时直接Request如:xxx.aspx?id=System.Web.HttpUtility.UrlEncode("中国");则可以在xxx.aspx中:Request["id"]
      

  6.   

    public string check(string s1)
    {
    Encoding enc = Encoding.GetEncoding("GB2312");
    char c,d;
    byte a=0,b=0;

    byte[] bytes=new byte[s1.Length /2];
    char[] chars=new char[s1.Length];
    char[] chars1=s1.ToCharArray ();
    for(int i=0 ;i<chars1.Length ;i=i+2)
    {c=chars1[i];
    d=chars1[i+1];
    switch( c)
    {
    case 'A':
    a=(byte)10;
    break;
    case 'B':
    a=(byte)11;
    break;
    case 'C':
    a=(byte)12;
    break;
    case 'D':
    a=(byte)13;
    break;
    case 'E':
    a=(byte)14;
    break;
    case 'F':
    a=(byte)15;
    break;
    default:
    a=byte.Parse(chars1[i].ToString ());
    break;
    }
    switch(d)
    {
    case 'A':
    b=(byte)10;
    break;
    case 'B':
    b=(byte)11;
    break;
    case 'C':
    b=(byte)12;
    break;
    case 'D':
    b=(byte)13;
    break;
    case 'E':
    b=(byte)14;
    break;
    case 'F':
    b=(byte)15;
    break;
    default:
    b=byte.Parse (chars1[i+1].ToString ());
    break;
    }

    bytes[i/2]=(byte)(a*16+b);
    }
    string s=enc.GetString(bytes);
    int co=s.Length ;

    return s.ToString ();
    }
      

  7.   

    to redbb(....Dotneter....)我这样使用check("那里")为啥出错,是不是参数s1是某种编码
      

  8.   

    to  redbb(....Dotneter....) 为啥还有部分乱码,如发:你是谁
      

  9.   

    C#开发的短信群发软件
    采用AT指令集使用GPRS MODE或手机
    下载地址:http://www.szlon.com