[b]海之川老师 你来吧[/b]winform 下 网络编码的问题

ZoeToString 2010-09-26 05:58:39
string news = txtnews.Text;

string data = "source=692960030&status=news";

//System.Web.HttpUtility.UrlEncode(t_news);

接收的全是问号,然后再 winform下也没有 System.Web.HttpUtility.UrlEncode() 这个方法,那么如何进行编码呢???????????


如何解决乱码问题啊
...全文
104 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ZoeToString 2010-09-26
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 zoetostring 的回复:]

引用 4 楼 wuyq11 的回复:

添加web引用
System.Web.HttpUtility.UrlEncode可使用
byte[] sendData = Encoding.GetEncoding("").GetBytes(postData);


不行啊。
winfrom:
错误 1 类型“System.Web.HttpUtility”中不存在类型名称“UrlEnco……
[/Quote]


解决了,谢谢
ZoeToString 2010-09-26
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 wuyq11 的回复:]

添加web引用
System.Web.HttpUtility.UrlEncode可使用
byte[] sendData = Encoding.GetEncoding("").GetBytes(postData);
[/Quote]

不行啊。
winfrom:
错误 1 类型“System.Web.HttpUtility”中不存在类型名称“UrlEncode”


  • 打赏
  • 举报
回复
围观楼主的结贴率啊
wuyq11 2010-09-26
  • 打赏
  • 举报
回复
添加web引用
System.Web.HttpUtility.UrlEncode可使用
byte[] sendData = Encoding.GetEncoding("").GetBytes(postData);
zhouqing123n 2010-09-26
  • 打赏
  • 举报
回复
xxxxxxxxxxx
ZoeToString 2010-09-26
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 xu56180825 的回复:]

又没“/"你用那个编码做什么?,按正常发送就好了,无需编码
[/Quote]
不是这个意思 ,是 下面这种 传送,加上一个url:

url = "http://api.t.sina.com.cn/statuses/update.json"+data

data在发送后 显示是 乱码
xu56180825 2010-09-26
  • 打赏
  • 举报
回复
又没“/"你用那个编码做什么?,按正常发送就好了,无需编码

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧