user-0 提问: 1f8b08是gzip的文件标记吗？那1fc2808呢？我用C+zlib解析不了。

回复:
user: user-1
content: 先 http://www.microsoft.com/visualstudio/chs/downloads#d-2010-express 点开Visual C++ 2010 Express下面的语言选‘简体中文’，再点立即安装  再参考 C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src\cvt\latin2 C:\Program Files\Microsoft Visual Studio 10.0\VC\include\cvt\latin2

user: user-0
content: utf-8转latin1好难哦，调试了两天，今天见到曙光了，不过转换的结果解压只得部分结果，现在还没确定是转换代码的问题，还是解压代码的问题?  iconv库要是自己编译的吧，WIN＋CocdBlocks+gcc，头大。有没有现成的utf-8转latin1的C代码？！谢谢。

user: user-2
content: 引用 18 楼 Qiaorui 的回复:[quote=引用 14 楼 angel_su 的回复:] 试试utf-8转latin1，确定开头是1f8b08才能gzip解码... 表示不熟悉ISO Latin-1字符集，尽管学XML时已经用过，但是确定不知道已经用了ISO Latin-1字符集:) [/quote]  1.txt是上面你说的256字节数据，转成latin1后像是gzip的...  User@T2370 ~ $ od -t x1 1.txt 0000000 1f c2 8b 08 00 00 00 00 00 00 00 c3 ad c2 bd c3 0000020 ab 73 c3 9b 58 7a 27 c3 bc 7d c3 bf c2 8a c2 ae 0000040 c3 be c2 b0 c2 b5 5b c3 a5 c3 99 c3 b8 c3 92 c2 0000060 9d c2 9d 79 c2 91 49 6a c2 92 77 53 c2 b5 c2 bb 0000100 c3 89 5e 2a c3 99 c3 bd c3 ae c3 8c 38 c3 99 c2 0000120 ae 77 c2 a6 3d c3 9b c3 ad 4e 32 7f 0e 48 59 c2 0000140 a6 25 c3 8a c3 a2 0d 00 49 c3 b0 4e c2 90 04 01 0000160 c2 82 c2 84 00 10 c2 a4 69 c3 99 c2 b2 64 59 6e 0000200 5b c2 b6 c2 ac c3 8b c2 b4 24 4b 2d c3 97 7b 7e 0000220 38 c2 84 48 c3 aa 4a c3 88 c2 a4 2f c3 89 54 c3 0000240 99 22 70 c3 8e c3 81 01 c3 b0 c3 a0 5c c2 9e c3 0000260 ab c3 af c3 b9 c2 93 3f c3 bb c3 a7 c3 9f c3 bc 0000300 c3 ba c2 b3 7f c2 bc c3 b1 c3 8d c2 b7 5f c3 9d 0000320 c3 bc c3 ba c3 a7 c2 9f 5f c3 b9 0f c2 97 3f c3 0000340 bf c3 ac c3 86 c3 97 c2 bf c2 bc c3 b9 c2 ab c2 0000360 af c2 be c3 be c2 87 c2 9f 7f c3 be c2 bf c3 be 0000400  User@T2370 ~ $ iconv -f utf-8 -t latin1 1.txt | od -t x1 0000000 1f 8b 08 00 00 00 00 00 00 00 ed bd eb 73 db 58 0000020 7a 27 fc 7d ff 8a ae fe b0 b5 5b e5 d9 f8 d2 9d 0000040 9d 79 91 49 6a 92 77 53 b5 bb c9 5e 2a d9 fd ee 0000060 cc 38 d9 ae 77 a6 3d db ed 4e 32 7f 0e 48 59 a6 0000100 25 ca e2 0d 00 49 f0 4e 90 04 01 82 84 00 10 a4 0000120 69 d9 b2 64 59 6e 5b b6 ac cb b4 24 4b 2d d7 7b 0000140 7e 38 84 48 ea 4a c8 a4 2f c9 54 d9 22 70 ce c1 0000160 01 f0 e0 5c 9e eb ef f9 93 3f fb e7 df fc fa b3 0000200 7f bc f1 cd b7 5f dd fc fa e7 9f 5f f9 0f 97 3f 0000220 ff ec c6 d7 bf bc f9 ab af be fe 87 9f 7f fe bf 0000240 fe 0000241

user: user-3
content: file命令LZ可有使用？

user: user-3
content: 引用 17 楼 Qiaorui 的回复:[quote=引用 13 楼 ForestDB 的回复:] file命令LZ可有使用？ 没有linux环境，也不大懂:([/quote] 有可能但是自己不去尝试，那没办法了。

user: user-0
content: 引用 14 楼 angel_su 的回复:试试utf-8转latin1，确定开头是1f8b08才能gzip解码... 表示不熟悉ISO Latin-1字符集，尽管学XML时已经用过，但是确定不知道已经用了ISO Latin-1字符集:)

user: user-0
content: 引用 13 楼 ForestDB 的回复:file命令LZ可有使用？ 没有linux环境，也不大懂:(

user: user-0
content: 我写的代码，头三个字节1F 8B 08可以解压缩，但是1f c2 8b 08开头一直毫无头绪

user: user-4
content: 该格式是web服务传递数据过程中默认的Gzip数据压缩格式。  头三个字节1F 8B 08可以解压缩。本人亲测过，POST数据解压缩。  BOOL fnGzipDecompressPacket   (__IN_PARAM unsigned char* gzipDataBuffer,   __IN_PARAM size_t gzipDataBuffer_Length,    __OUT_PARAM char* pChDataBuffer,   __OUT_PARAM DWORD *pdwLength);    封装好的函数。  http://blog.csdn.net/microzone/article/details/38367797

user: user-2
content: 试试utf-8转latin1，确定开头是1f8b08才能gzip解码...

user: user-0
content: 前256字节数据  0x3d55f8: 1f c2 8b 08 00 00 00 00|00 00 00 c3 ad c2 bd c3    .??........?-??? 0x3d5608: ab 73 c3 9b 58 7a 27 c3|bc 7d c3 bf c2 8a c2 ae    ?s??Xz'??}?????? 0x3d5618: c3 be c2 b0 c2 b5 5b c3|a5 c3 99 c3 b8 c3 92 c2    ???°?μ[?￥??????? 0x3d5628: 9d c2 9d 79 c2 91 49 6a|c2 92 77 53 c2 b5 c2 bb    ???y??Ij??wS?μ?? 0x3d5638: c3 89 5e 2a c3 99 c3 bd|c3 ae c3 8c 38 c3 99 c2    ??^*????????8??? 0x3d5648: ae 77 c2 a6 3d c3 9b c3|ad 4e 32 7f 0e 48 59 c2    ?w?|=???-N2.HY? 0x3d5658: a6 25 c3 8a c3 a2 0d 00|49 c3 b0 4e c2 90 04 01    |%???￠..I?°N??.. 0x3d5668: c2 82 c2 84 00 10 c2 a4|69 c3 99 c2 b2 64 59 6e    ????..?¤i???2dYn 0x3d5678: 5b c2 b6 c2 ac c3 8b c2|b4 24 4b 2d c3 97 7b 7e    [???????′$K-??{~ 0x3d5688: 38 c2 84 48 c3 aa 4a c3|88 c2 a4 2f c3 89 54 c3    8??H?aJ???¤/??T? 0x3d5698: 99 22 70 c3 8e c3 81 01|c3 b0 c3 a0 5c c2 9e c3    ?"p????.?°??\??? 0x3d56a8: ab c3 af c3 b9 c2 93 3f|c3 bb c3 a7 c3 9f c3 bc    ??ˉ?1??????§???? 0x3d56b8: c3 ba c2 b3 7f c2 bc c3|b1 c3 8d c2 b7 5f c3 9d    ?o?3???±???·_?? 0x3d56c8: c3 bc c3 ba c3 a7 c2 9f|5f c3 b9 0f c2 97 3f c3    ???o?§??_?1.???? 0x3d56d8: bf c3 ac c3 86 c3 97 c2|bf c2 bc c3 b9 c2 ab c2    ????????????1??? 0x3d56e8: af c2 be c3 be c2 87 c2|9f 7f c3 be c2 bf c3 be    ˉ??????????????   使用UTF-8转UNICODE后得到以下数据，可是zlib好像不支持wcar_t  0x3d3dd8: 1f 00 8b 00 08 00 00 00|ab ab ab ab ab ab ab ab    ..?.....???????? 0x3d3de8: 00 00 00 00 00 00 00 00|04 00 04 00 00 07 18 00    ................ 0x3d3df8: 89 3d 3d 00 00 00 00 00|ab ab ab ab ab ab ab ab    ?==.....???????? 0x3d3e08: 00 00 00 00 00 00 00 00|0e 00 04 00 00 07 1c 00    ................ 0x3d3e18: 01 00 00 00 a8 03 00 00|a8 03 00 00 00 00 00 00    ....¨...¨....... 0x3d3e28: 04 08 00 00 04 08 00 00|04 08 00 00 04 08 00 00    ................ 0x3d3e38: 04 08 00 00 00 00 00 00|02 00 00 00 f8 27 3d 00    ............?'=. 0x3d3e48: 18 28 3d 00 d0 3f 3d 00|b0 27 3d 00 b0 27 3d 00    .(=.D?=.°'=.°'=. 0x3d3e58: 08 3f 3d 00 70 24 3d 00|72 24 3d 00 f0 3f 3d 00    .?=.p$=.r$=.e?=. 0x3d3e68: f0 3f 3d 00 ab ab ab ab|ab ab ab ab ee fe ee fe    e?=.?????????t?t 0x3d3e78: 00 00 00 00 00 00 00 00|08 00 0e 00 00 07 19 00    ................ 0x3d3e88: 43 68 69 6e 65 73 65 5f|50 65 6f 70 6c 65 27 73    Chinese_People's 0x3d3e98: 20 52 65 70 75 62 6c 69|63 20 6f 66 20 43 68 69     Republic of Chi 0x3d3ea8: 6e 61 2e 39 33 36 00 ab|ab ab ab ab ab ab ab fe    na.936.????????t 0x3d3eb8: 00 00 00 00 00 00 00 00|08 00 08 00 00 07 19 00    ................ 0x3d3ec8: 43 68 69 6e 65 73 65 5f|50 65 6f 70 6c 65 27 73    Chinese_People's   再转ANSI，文件头又不对了  0x4c0048: 1f 3f 08 00 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .?...e-o.e-o.e-o 0x4c0058: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c0068: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c0078: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c0088: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c0098: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c00a8: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c00b8: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c00c8: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c00d8: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c00e8: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c00f8: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c0108: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c0118: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c0128: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o 0x4c0138: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .e-o.e-o.e-o.e-o

user: user-5
content: 怀疑是UTF－8编码的数据，java写的。

user: user-0
content: 前256字节数据  0x3d55f8: 1f c2 8b 08 00 00 00 00|00 00 00 c3 ad c2 bd c3    .??........?-??? 0x3d5608: ab 73 c3 9b 58 7a 27 c3|bc 7d c3 bf c2 8a c2 ae    ?s??Xz'??}?????? 0x3d5618: c3 be c2 b0 c2 b5 5b c3|a5 c3 99 c3 b8 c3 92 c2    ???°?μ[?￥??????? 0x3d5628: 9d c2 9d 79 c2 91 49 6a|c2 92 77 53 c2 b5 c2 bb    ???y??Ij??wS?μ?? 0x3d5638: c3 89 5e 2a c3 99 c3 bd|c3 ae c3 8c 38 c3 99 c2    ??^*????????8??? 0x3d5648: ae 77 c2 a6 3d c3 9b c3|ad 4e 32 7f 0e 48 59 c2    ?w?|=???-N2.HY? 0x3d5658: a6 25 c3 8a c3 a2 0d 00|49 c3 b0 4e c2 90 04 01    |%???￠..I?°N??.. 0x3d5668: c2 82 c2 84 00 10 c2 a4|69 c3 99 c2 b2 64 59 6e    ????..?¤i???2dYn 0x3d5678: 5b c2 b6 c2 ac c3 8b c2|b4 24 4b 2d c3 97 7b 7e    [???????′$K-??{~ 0x3d5688: 38 c2 84 48 c3 aa 4a c3|88 c2 a4 2f c3 89 54 c3    8??H?aJ???¤/??T? 0x3d5698: 99 22 70 c3 8e c3 81 01|c3 b0 c3 a0 5c c2 9e c3    ?"p????.?°??\??? 0x3d56a8: ab c3 af c3 b9 c2 93 3f|c3 bb c3 a7 c3 9f c3 bc    ??ˉ?1??????§???? 0x3d56b8: c3 ba c2 b3 7f c2 bc c3|b1 c3 8d c2 b7 5f c3 9d    ?o?3???±???·_?? 0x3d56c8: c3 bc c3 ba c3 a7 c2 9f|5f c3 b9 0f c2 97 3f c3    ???o?§??_?1.???? 0x3d56d8: bf c3 ac c3 86 c3 97 c2|bf c2 bc c3 b9 c2 ab c2    ????????????1??? 0x3d56e8: af c2 be c3 be c2 87 c2|9f 7f c3 be c2 bf c3 be    ˉ??????????????  使用UTF-8转UNICODE后得到以下数据，可是zlib好像不支持wcar_t，  再转ANSI，数据又变成1F3F08

user: user-0
content: http://bbs.csdn.net/topics/390618397这里有个贴子，同样的HEX头，就是不知道如何编码解压。

user: user-0
content: 从文件的用途和文件头前四字节，基本上可断定这是.gz文件。就是不好理解第2字节的C2怎么来。看文件编码是UTF-8，但是fread()又读不出UTF-8的标志，郁闷。 哪位遇到过同样的问题，指点一下迷津，感激不尽。

user: user-3
content: 可以用linux的file命令帮你猜测。

user: user-3
content: http://www.astro.keele.ac.uk/oldusers/rno/Computing/File_magic.html  Compressed files File type 	Typical extension 	Hex digits xx = variable 	Ascii digits . = not an ascii char Bzip 	.bz 	42 5a 	BZ Compress 	.Z 	1f 9d 	.. gzip format 	.gz 	1f 8b 	.. pkzip format 	.zip 	50 4b 03 04 	PK..

user: user-0
content: 查了很多资料，gz文件头格式为1F8B08，其中08代表压缩方式，我的代码可以解压。但这次文件头居然是1FC28B08，这个C2是怎么回事呢？求高手指教！

user: user-6
content: 应该是gzip（.gz）格式的，无论怎样可以试着用7-zip来解压。

user: user-0
content: 7-Zip解不开，网站用的离线包，应该遵守一定的规则吧？哪有相关说明呢，有C代码更佳。