閱讀上一個主題 :: 閱讀下一個主題 |
作者 |
正文 |
webdriver (只看此人)

|
|
樓主 |
電梯直達
|
|
陸壓 (只看此人)

|
時間: 2014-9-28 08:30
|
|
|
|
|
|
沙發 |
返回頂端
|
|
webdriver (只看此人)

|
時間: 2014-9-28 09:38
|
|
|
I tried many different ways, and one of it like this:
代碼: |
string tempstr = null;
Encoding myencoding = Encoding.GetEncoding("gb2312");
System.Net.WebResponse res = req.GetResponse();
System.IO.Stream ReceiveStream = res.GetResponseStream();
using (System.IO.StreamReader sr = new System.IO.StreamReader(ReceiveStream, myencoding))
{
{
tempstr = sr.ReadToEnd();
sr.Close();
}
//Char[] read = new Char[256];
//int count = sr.Read(read, 0, 256);
//while (count > 0)
//{
// String str = new String(read, 0, count);
// tempstr += str;
// count = sr.Read(read, 0, 256);
//}
}
byte[] rcvData = myencoding.GetBytes(tempstr);
MemoryStream mStream = new MemoryStream(rcvData);
mStream.Seek(0, SeekOrigin.Begin);
DeflateStream unZipStream = new DeflateStream(mStream, CompressionMode.Decompress, true);
object dsResult = null;
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
dsResult = (object)bFormatter.Deserialize(unZipStream);
Out = dsResult.ToString();
|
It stops at 'Deserialize' for that error
_________________ There is no wisdom tree; nor a stand of a mirror bright, Since all is void, where can the dust alight?
|
|
|
板凳 |
返回頂端
|
|
陸壓 (只看此人)

|
時間: 2014-9-28 10:01
|
|
|
At least, i would try deflate first, then decode the gb2312
_________________ 烈焰空燒吾秘授
|
|
|
地板 |
返回頂端
|
|
本那比經略 (只看此人)

|
時間: 2014-9-28 10:12
|
|
|
報告老大,這裡有人明目張膽地教授機器人發帖技術。。。:lol:
|
|
|
5 樓 |
返回頂端
|
|
六叔 (只看此人)

|
|
6 樓 |
返回頂端
|
|
webdriver (只看此人)

|
|
7 樓 |
返回頂端
|
|
webdriver (只看此人)

|
時間: 2014-9-28 11:53
|
|
|
btw here is what the sniffer got the response header:
-------------------------------------------------------
HTTP/1.1 200 OK
Date: Sun, 28 Sep 2014 18:49:59 GMT
Server: Apache
.....
.....
.....
Content-Encoding: gzip
Vary: Accept-Encoding
X-Powered-By: PleskLin
MS-Author-Via: DAV
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=GB2312
------------------------------------------------------
_________________ There is no wisdom tree; nor a stand of a mirror bright, Since all is void, where can the dust alight?
|
|
|
8 樓 |
返回頂端
|
|
本那比經略 (只看此人)

|
|
9 樓 |
返回頂端
|
|
陸壓 (只看此人)

|
時間: 2014-9-28 13:36
|
|
|
代碼: |
myReq.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
|
that's all
|
|
|
10 樓 |
返回頂端
|
|
|
 |
論壇首頁
-> IT人生 |
所有的時間均為 美國太平洋時間
|
第1頁,共2頁 |
分頁: 1, 2 下一頁 |
|
注: 以上論壇所有發言僅代表發帖者個人觀點, 並不代表本站觀點或立場, 加西網對此不負任何責任。 投資理財及買房賣房版面的帖子不構成投資建議。投資有風險,責任請自負對二手買賣中的虛假信息,買賣中的糾紛等均與本站無關。 |
|
您不能在本論壇發表新主題 您不能在本論壇回復主題 您不能在本論壇編輯自己的文章 您不能在本論壇刪除自己的文章 您不能在本論壇發表投票 您不能在這個論壇添加附件 您可以在這個論壇下載文件
論壇轉跳:
|
|
webdriver, 陸壓, webdriver, 陸壓, 本那比經略, 六叔, webdriver, webdriver, 本那比經略, 陸壓
|
|
|