编码问题?求救!!(100分)
im_is 2006-11-30 06:39:56 我做的是一个手机发短信的功能,
短信平台的提供商提供的是http接口,
如:http://www.10808.net/?msg=好的&dt=139658954256
这样就可以发短信了,给139658954256发一条“好的”短信
但是提供商有个条件,这个http的url必须是gb2312的。
我的代码如下:
WebClient wc = new WebClient();
String tempS;
string requestUrl = "http://webservice.10808.net/servlet/sms/smssend.xsms?"
+ "type=C&name=5658&pwd=45698&cpname=[中国]&dst=13489814522&msg=你好";
Encoding gb2312Enc = Encoding.GetEncoding("GB2312");
Encoding utf8Enc = Encoding.UTF8;
byte[] unicodeBytes = utf8Enc.GetBytes(requestUrl);
byte[] asciiBytes = Encoding.Convert(utf8Enc, gb2312Enc, unicodeBytes);
char[] asciiChars = new char[gb2312Enc.GetCharCount(asciiBytes, 0, asciiBytes.Length)];
gb2312Enc.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0);
tempS = new string(asciiChars);
wc.OpenRead(tempS);
但是对方收到的短信就是中文乱码,也就是说我的编码过程有问题?
希望高手能给点建议???··