-
GZIP Data
Does c# interpret gzip data differently than vb6? I rewrote one of my vb6 programs in c# and i send a request, and receive data back. Then i split the data into headers and body. I then try to decompress the gzip body and it always fails with a "magic number is wrong" error. I tried my decompression on data generated from my vb6 project and it works fine, so it must have something to do with c# interprets it, or how i put it into the stream i decompress from. I found that if i put ‹ (not <) between the 2 box characters at the beggining of my gzip data, it fails with a crc error instead, probably because i added data. Here's is how i put the string of data i received into the stream for decompression.
Code:
public static byte[] StrToByteArray(string str)
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
return encoding.GetBytes(str);
}
byte[] strHTMLb = StrToByteArray(strParts[1]);
MemoryStream memstream = new MemoryStream(strHTMLb);
Thanks for any ideas or help
-
None of the code you've given us will help us help you. Where does the data come from? Are you sure the data isn't corrupt? How do you split the file into a header section and a data section? Why are you even spliting the file, since you could use the GZipStream class (which, ironically, is the same advice you got from VBForums).