如何使用未知算法解码字符串?

时间:2016-10-14 08:50:25

标签: http encode mojibake

我使用Fiddler捕获http请求,但在http体中遇到mojibake。

mojibake http request img

我将http主体复制为bas64编码并尝试知道它是什么。

有base64编码字符串:

H4sIAAAAAAAAAIVUz2/cRBR2ckAcEFeuZYSE1O5aM+MZz9gHqONdixyaA0XNoa2qWXucjOK1t/6R7DYbqULcuNBKgLhFIQiQUoEQNy4lFw45cF9x459A4sLzbrNJowKWZc37Md/3/M1788XMettxPEcPBsqNB1JIJiRPJeNM0kQOUpzyeGZdIyTi2OlxFlEacRawXkR6nrfGRcQ8yp2vfo6Loa3ypCxMYleTqtbDxvzIbGbTrmO7NrGxoN4R8X63rJU7v9SH7/0ULLJvfNS7cYfY1BYMiAIZ9J2eE4UsXIt6QUix47q8x4UXMIrX+qfz/eyv1z5YLv6w3vphYLYqNayafMvfKMabwPP0zHrxLBdfj6V7Iii+TqjE1ynHR+HGSbhtcnXtVjEwmT56tP36s/Oy5rVbx5vr0frpN8zFGC++h4fWzPqYTqkQEgtGOQG1PG8ahUFAWJ/1HS4gDU8dTqlkGASVgrtk2u4WlFMiMGGUTqUnwSMJJpec/3sY07zJsmlejGer797dR3FTljqvkQ9rkyAfRaEfBD5hfh9ex+cCdVCmd3WG/C7nHVSNtIY8gnEHbZsk0TnyU5VVuoNyXe8V5c46hCGYq6EGvHto05Q6uX17vXcPAVayHY+Qv4+SvCIA40rJPU47aKiqndYWQlACPBCnc5xMq0r3mlLVpgAu6bKWutLlri6Rz0AlTAQAbO1dtgyQUJe41PEkPmjh43/5uZcz7wN0rPJcDTJ9IQomvsR+TH2M569zRZS6gtKZcBn1HI9jj3VQWuqHAMwIXUqxFAK1NGpXmWxBU5cNyFdPRm3WnkkNwMdFnpqtpmzFhjJGpSlKU0/+S9rL+rcMAJHruG4RWoaDzv45R6yzrMlUiV5KenGMVwo7uD+zfrt7sRXmtNZ5DE1jD2Fk47hooH+WRf35+DFqmfS4LhWcMJo3PcTnDjhSFN4Kw3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/+S9rL+rcMAJHruG4RWoaDzv45R6yzrMlUiV5KenGMVwo7uD+zfrt7sRXmtNZ5DE1jD2Fk47hooH+WRf35+DFqmfS4LhWcMJo3PcTnDjhSFN4Kw3ObtfZG2xamGmVqsrEAudLqaClOZYbnW10wr4zIRRWvmg1Q3bKePF39cma9o2IpU+k5XXeARZelmHYVTWlXJ2nsAJJ2vbi9IDZ//fvNh6vWZ08+f/bgQT22q2THrnSeHK7Mo6dvvH/yyVFdfK9ylU1qE1fHcZHos5tmcWN8m6lWq8nZzQ+fzx3HlXkE4U+/m1srz/8Br1K6vkAFAAA=";

$str = base64_decode($b64Encode);
$str = gzdecode($str);

var_dump($str);
file_put_contents('d:/123.txt', $str);

$enclist = array( 
            'UTF-8', 'ASCII', 
            'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 
            'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10', 
            'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'ISO-8859-16', 
            'Windows-1251', 'Windows-1252', 'Windows-1254', 'GBK', 'GB2312',
            );
var_dump(mb_detect_encoding($str, $enclist));


$str2 = iconv("ISO-8859-1", "UTF-8", $str);
var_dump($str2);

php result img

已经是mojibake了。如何解码?

0 个答案:

没有答案