* core: myStylite Ticket#987: fixing a problem regarding chopped off urls when URI in question contains umlauts AND mbstring.func_overload is activated

This commit is contained in:
Klaus Leithoff 2010-11-09 14:28:20 +00:00
parent 65813764ed
commit 0c66ee71e3

View File

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