Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions idna_convert.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ protected function _decode($encoded)
$delim_pos = strrpos($encoded, '-');
if ($delim_pos > self::byteLength($this->_punycode_prefix)) {
for ($k = self::byteLength($this->_punycode_prefix); $k < $delim_pos; ++$k) {
$decoded[] = ord($encoded{$k});
$decoded[] = ord(substr($encoded, $k, 1));
}
}
$deco_len = count($decoded);
Expand All @@ -437,7 +437,7 @@ protected function _decode($encoded)

for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) {
for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) {
$digit = $this->_decode_digit($encoded{$enco_idx++});
$digit = $this->_decode_digit(substr($encoded, $enco_idx++, 1));
$idx += $digit * $w;
$t = ($k <= $bias) ? $this->_tmin :
(($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias));
Expand Down Expand Up @@ -864,7 +864,7 @@ protected function _utf8_to_ucs4($input)
$mode = 'next';
$test = 'none';
for ($k = 0; $k < $inp_len; ++$k) {
$v = ord($input{$k}); // Extract byte from input string
$v = ord(substr($input, $k, 1)); // Extract byte from input string
if ($v < 128) { // We found an ASCII char - put into stirng as is
$output[$out_len] = $v;
++$out_len;
Expand Down Expand Up @@ -995,7 +995,7 @@ protected function _ucs4_string_to_ucs4($input)
$out_len++;
$output[$out_len] = 0;
}
$output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) );
$output[$out_len] += ord(substr($input, $i, 1)) << (8 * (3 - ($i % 4) ) );
}
return $output;
}
Expand Down Expand Up @@ -3458,4 +3458,4 @@ public function singleton($params = array())
0x361 => 234, 0x345 => 240
)
);
}
}
6 changes: 2 additions & 4 deletions transcode_wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function map_w1252_iso8859_1($string = '')
if ($string == '') return '';
$return = '';
for ($i = 0; $i < strlen($string); ++$i) {
$c = ord($string{$i});
$c = ord(substr($string, $i, 1));
switch ($c) {
case 129: $return .= chr(252); break;
case 132: $return .= chr(228); break;
Expand All @@ -119,7 +119,7 @@ function map_iso8859_1_w1252($string = '')
if ($string == '') return '';
$return = '';
for ($i = 0; $i < strlen($string); ++$i) {
$c = ord($string{$i});
$c = ord(substr($string, $i, 1));
switch ($c) {
case 196: $return .= chr(142); break;
case 214: $return .= chr(153); break;
Expand All @@ -133,5 +133,3 @@ function map_iso8859_1_w1252($string = '')
}
return $return;
}

?>
11 changes: 5 additions & 6 deletions uctc.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static function utf8_ucs4array($input)
$mode = 'next';
$test = 'none';
for ($k = 0; $k < $inp_len; ++$k) {
$v = ord($input{$k}); // Extract byte from input string
$v = ord(substr($input, $k, 1)); // Extract byte from input string

if ($v < 128) { // We found an ASCII char - put into stirng as is
$output[$out_len] = $v;
Expand Down Expand Up @@ -176,7 +176,7 @@ private static function utf7_ucs4array($input, $sc = '+')
$b64 = '';

for ($k = 0; $k < $inp_len; ++$k) {
$c = $input{$k};
$c = substr($input, $k, 1);
if (0 == ord($c)) continue; // Ignore zero bytes
if ('b' == $mode) {
// Sequence got terminated
Expand All @@ -193,10 +193,10 @@ private static function utf7_ucs4array($input, $sc = '+')
$tmp = substr($tmp, -1 * (strlen($tmp) % 2));
for ($i = 0; $i < strlen($tmp); $i++) {
if ($i % 2) {
$output[$out_len] += ord($tmp{$i});
$output[$out_len] += ord(substr($tmp, $i, 1));
$out_len++;
} else {
$output[$out_len] = ord($tmp{$i}) << 8;
$output[$out_len] = ord(substr($tmp, $i, 1)) << 8;
}
}
$mode = 'd';
Expand Down Expand Up @@ -292,9 +292,8 @@ private static function ucs4_ucs4array($input)
$out_len++;
$output[$out_len] = 0;
}
$output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) );
$output[$out_len] += ord(substr($input, $i, 1)) << (8 * (3 - ($i % 4) ) );
}
return $output;
}
}
?>