summaryrefslogtreecommitdiff
path: root/program/lib
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-06-30 09:54:32 +0000
committeralecpl <alec@alec.pl>2008-06-30 09:54:32 +0000
commit0a5e6a5454fb6a98626bce37a6b489b787227aa1 (patch)
tree8b947fe1a98aaaa843a319261c802bb6c75fa4fa /program/lib
parente189a6ca18fe43def249c78a0e89405012981de5 (diff)
- fixed utf7_to_utf8() for numeric input (#1485175)
Diffstat (limited to 'program/lib')
-rw-r--r--program/lib/utf7.inc13
1 files changed, 7 insertions, 6 deletions
diff --git a/program/lib/utf7.inc b/program/lib/utf7.inc
index 9ea5f6db5..d2068be79 100644
--- a/program/lib/utf7.inc
+++ b/program/lib/utf7.inc
@@ -39,16 +39,17 @@ function utf7_to_utf8($str)
);
$u7len = strlen($str);
+ $str = strval($str);
$p = $err = '';
for ($i=0; $u7len > 0; $i++, $u7len--)
{
- $u7 = $str{$i};
+ $u7 = $str[$i];
if ($u7 == '&')
{
$i++;
$u7len--;
- $u7 = $str{$i};
+ $u7 = $str[$i];
if ($u7len && $u7 == '-')
{
@@ -60,7 +61,7 @@ function utf7_to_utf8($str)
$k = 10;
for (; $u7len > 0; $i++, $u7len--)
{
- $u7 = $str{$i};
+ $u7 = $str[$i];
if ((ord($u7) & 0x80) || ($b = $Index_64[ord($u7)]) == -1)
break;
@@ -106,7 +107,7 @@ function utf7_to_utf8($str)
return $err;
/* Adjacent BASE64 sections */
- if ($u7len > 2 && $str{$i+1} == '&' && $str{$i+2} != '-')
+ if ($u7len > 2 && $str[$i+1] == '&' && $str[$i+2] != '-')
return $err;
}
/* Not printable US-ASCII */
@@ -141,7 +142,7 @@ function utf8_to_utf7($str)
while ($u8len)
{
- $u8 = $str{$i};
+ $u8 = $str[$i];
$c = ord($u8);
if ($c < 0x80)
@@ -187,7 +188,7 @@ function utf8_to_utf7($str)
for ($j=0; $j < $n; $j++)
{
- $o = ord($str{$i+$j});
+ $o = ord($str[$i+$j]);
if (($o & 0xc0) != 0x80)
return $err;
$ch = ($ch << 6) | ($o & 0x3f);