note 63501 added to function.pack
| From: | Newdawn dot dk at osu1 dot php dot net | Date: | Thu, 23 Mar 2006 00:25:51 +0000 |
| Subject: | note 63501 added to function.pack | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-106401@lists.php.net to get a copy of this message | ||
When trying to create a ZIP file using the pack function - I experienced trouble with the
"a" code - It converted all chars correct from the std. ASCII charset but not more
language specific like ÃøÃ
.
It seems that ZIP files do not use the same HEX for these as everything else does.
The fix was a quick workaround but you'll probably get the picture:
function UniHex($str) {
// æ ø Ã¥ à à Ã
//These are simply one HEX code being replaced by another to correct the issue
$except =
array("E6"=>"91","F8"=>"9B","E5"=>"86","C6"=>"92","D8"=>"9D", "C5"=>"8F");
for($i = 0; $i < strlen($str); $i++) {
$hex = bin2hex(substr($str, $i, 1));
if ($except[strtoupper($hex)])
$hex = $except[strtoupper($hex)];
$return .= $hex;
}
return $return;
}
And then i replaced an "a100" code with "H".strlen(uniHex($mystring))
This is like i said a quick workaround, but if you find the real reason for this i'd be happy
to see it
----
Server IP: 66.163.161.117
Probable Submitter: 80.163.77.58
----
X-Spam-Status: Yes, hits=7.4 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HEAD_ILLEGAL_CHARS autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.pack.php
Edit -- http://master.php.net/note/edit/63501
Del: integrated -- http://master.php.net/note/delete/63501/integrated
Del: useless -- http://master.php.net/note/delete/63501/useless
Del: bad code -- http://master.php.net/note/delete/63501/bad+code
Del: spam -- http://master.php.net/note/delete/63501/spam
Del: non-english -- http://master.php.net/note/delete/63501/non-english
Del: in docs -- http://master.php.net/note/delete/63501/in+docs
Del: other reasons-- http://master.php.net/note/delete/63501
Reject -- http://master.php.net/note/reject/63501
Search -- http://master.php.net/manage/user-notes.php