extending patch rev32909/34417 (chopped off urls when URI contains umlauts AND mbstring.func_overload is activated): using rawurlencode instead of '%' . sprintf('%02X', ); as ord() only returns the int for the first character in a given string, thus crippling multibyte chars

This commit is contained in:
Klaus Leithoff 2011-06-08 09:55:26 +00:00
parent 9325d8d636
commit 123b46372b

View File

@ -52,7 +52,7 @@ class HTMLPurifier_PercentEncoder
//error_log(__METHOD__.__LINE__.$string); //error_log(__METHOD__.__LINE__.$string);
for ($i = 0, $c = strlen($string); $i < $c; $i++) { for ($i = 0, $c = strlen($string); $i < $c; $i++) {
if (substr($string,$i,1) !== '%' && !isset($this->preserve[$int = ord(substr($string,$i,1))]) ) { if (substr($string,$i,1) !== '%' && !isset($this->preserve[$int = ord(substr($string,$i,1))]) ) {
$ret .= '%' . sprintf('%02X', $int); $ret .= rawurlencode(substr($string,$i,1)); // '%' . sprintf('%02X', $int);
} else { } else {
$ret .= substr($string,$i,1); $ret .= substr($string,$i,1);
} }