跪求accii编码和utf8编码到底是杂回事?现在主流的是用的哪个. 在网上找到的所有发的帖子都是用accii编码.不过好象是主流的是用utf8编码.真是头疼.刚接触这个.net.也不知道应该怎么弄. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个还真不不清楚,不过我再做网站时上传到英文服务器上时有的中文字符会成为乱码显示,这时 保存成utf8并且带签名的,上传上去再浏览就不是乱码了.关于accii,我的手机上可以看电子书(文本形式的),可是,我把一些文本放上去看到的是乱码,最后我发现保存成 accii格式的就可以了继续学习 外文的东西好像 用utf8 比较多 楼主的意思是ASCII吧?ACSII是计算机发明不久就创建的编码方式,当时计算机只有在美国用,所以只要表示字母和特殊符号就行,一共256个。后来计算机进入中国,为了表示汉字中国发明了GB2312编码。但是后来由于编码标准太多(很多国家都有自己的编码。)所以产生了统一的unicode编码。utf-8是unicode编码方式 unicode基本可以表示世界上所有的符号。现在用utf-8吧。统一的规范总归是好的 坏了.费了老半天的劲才弄的这个是用accii 代码,现在要用utf8编码不会啊,真实麻烦。ASCIIEncoding encoding=new ASCIIEncoding(); string postData="COMMANDID=05"; byte[] data = encoding.GetBytes(postData); // Prepare web request HttpWebRequest myRequest =(HttpWebRequest)WebRequest.Create("http://61.156.3.58/test.jsp"); myRequest.Method = "POST"; myRequest.ContentType="application/x-www-form-urlencoded"; myRequest.ContentLength = data.Length; Stream newStream=myRequest.GetRequestStream(); // Send the data. newStream.Write(data,0,data.Length); newStream.Close(); HttpWebResponse webResponse=(HttpWebResponse)myRequest.GetResponse(); Stream stream=webResponse.GetResponseStream(); System.IO.StreamReader streamReader = new StreamReader(stream, System.Text.Encoding.GetEncoding("GB2312")); string content = streamReader.ReadToEnd(); // 关闭相关对象 Console.WriteLine (content); streamReader.Close(); webResponse.Close(); private void post(string url, string content){ Encoding encoding = Encoding.GetEncoding("GB2312"); byte[] data = encoding.GetBytes("xml="+content); // 准备请求... HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url); myRequest.Method = "POST"; myRequest.ContentType="application/x-www-form-urlencoded"; myRequest.ContentLength = data.Length; Stream newStream=myRequest.GetRequestStream(); // 发送数据 newStream.Write(data,0,data.Length); newStream.Close();}找到一个发送的文档,呵呵,先比着凑合着弄弄. 啥主流,统一utf。要不代码在不同语言的OS上就乱码了 Excel数据导入到DataGridView中的问题 关于栈的问题 DataGridView如何实现单列单独排序。 请问如何让DataGrid的某列绑定一个DownList控件?CS里的. C# winform抓屏的问题? 有关insert access数据库的问题 用Image控件来显示页面 刚上来,散100分,每人20分 好心人,谁捐点可用分给我了:) 急问题:请教高手如何控制用户输入的类型? C#的继承属性和强制转换 循环插入数据问题
不过我再做网站时上传到英文服务器上时有的中文字符会成为乱码显示,这时
保存成utf8并且带签名的,上传上去再浏览就不是乱码了.
关于accii,我的手机上可以看电子书(文本形式的),可是,我把一些文本放上去看到的是乱码,最后我发现保存成 accii格式的就可以了继续学习
ACSII是计算机发明不久就创建的编码方式,当时计算机只有在美国用,所以只要表示字母和特殊符号就行,一共256个。
后来计算机进入中国,为了表示汉字中国发明了GB2312编码。
但是后来由于编码标准太多(很多国家都有自己的编码。)所以产生了统一的unicode编码。
utf-8是unicode编码方式
现在用utf-8吧。统一的规范总归是好的
ASCIIEncoding encoding=new ASCIIEncoding();
string postData="COMMANDID=05";
byte[] data = encoding.GetBytes(postData);
// Prepare web request
HttpWebRequest myRequest =(HttpWebRequest)WebRequest.Create("http://61.156.3.58/test.jsp");
myRequest.Method = "POST";
myRequest.ContentType="application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream=myRequest.GetRequestStream();
// Send the data.
newStream.Write(data,0,data.Length);
newStream.Close();
HttpWebResponse webResponse=(HttpWebResponse)myRequest.GetResponse();
Stream stream=webResponse.GetResponseStream();
System.IO.StreamReader streamReader = new StreamReader(stream, System.Text.Encoding.GetEncoding("GB2312"));
string content = streamReader.ReadToEnd();
// 关闭相关对象
Console.WriteLine (content);
streamReader.Close();
webResponse.Close();
{
Encoding encoding = Encoding.GetEncoding("GB2312");
byte[] data = encoding.GetBytes("xml="+content); // 准备请求...
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
myRequest.Method = "POST";
myRequest.ContentType="application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream=myRequest.GetRequestStream();
// 发送数据
newStream.Write(data,0,data.Length);
newStream.Close();
}
找到一个发送的文档,呵呵,先比着凑合着弄弄.