mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
whitespace :P
git-svn-id: file:///svn/phpbb/trunk@6369 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
2a4c853f87
commit
ccaaa3a307
1 changed files with 79 additions and 79 deletions
|
@ -51,54 +51,54 @@ if (!extension_loaded('xml'))
|
||||||
// "borrowed" from getID3
|
// "borrowed" from getID3
|
||||||
function utf8_decode($string)
|
function utf8_decode($string)
|
||||||
{
|
{
|
||||||
$newcharstring = '';
|
$newcharstring = '';
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
$stringlength = strlen($string);
|
$stringlength = strlen($string);
|
||||||
while ($offset < $stringlength)
|
while ($offset < $stringlength)
|
||||||
{
|
{
|
||||||
$ord = ord($string{$offset});
|
$ord = ord($string{$offset});
|
||||||
if (($ord | 0x07) == 0xF7)
|
if (($ord | 0x07) == 0xF7)
|
||||||
{
|
{
|
||||||
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
|
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
|
||||||
$charval = (($ord & 0x07) << 18) &
|
$charval = (($ord & 0x07) << 18) &
|
||||||
((ord($string{($offset + 1)}) & 0x3F) << 12) &
|
((ord($string{($offset + 1)}) & 0x3F) << 12) &
|
||||||
((ord($string{($offset + 2)}) & 0x3F) << 6) &
|
((ord($string{($offset + 2)}) & 0x3F) << 6) &
|
||||||
(ord($string{($offset + 3)}) & 0x3F);
|
(ord($string{($offset + 3)}) & 0x3F);
|
||||||
$offset += 4;
|
$offset += 4;
|
||||||
}
|
}
|
||||||
else if (($ord | 0x0F) == 0xEF)
|
else if (($ord | 0x0F) == 0xEF)
|
||||||
{
|
{
|
||||||
// 1110bbbb 10bbbbbb 10bbbbbb
|
// 1110bbbb 10bbbbbb 10bbbbbb
|
||||||
$charval = (($ord & 0x0F) << 12) &
|
$charval = (($ord & 0x0F) << 12) &
|
||||||
((ord($string{($offset + 1)}) & 0x3F) << 6) &
|
((ord($string{($offset + 1)}) & 0x3F) << 6) &
|
||||||
(ord($string{($offset + 2)}) & 0x3F);
|
(ord($string{($offset + 2)}) & 0x3F);
|
||||||
$offset += 3;
|
$offset += 3;
|
||||||
}
|
}
|
||||||
else if (($ord | 0x1F) == 0xDF)
|
else if (($ord | 0x1F) == 0xDF)
|
||||||
{
|
{
|
||||||
// 110bbbbb 10bbbbbb
|
// 110bbbbb 10bbbbbb
|
||||||
$charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
|
$charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
|
||||||
(ord($string{($offset + 1)}) & 0x3F);
|
(ord($string{($offset + 1)}) & 0x3F);
|
||||||
$offset += 2;
|
$offset += 2;
|
||||||
}
|
}
|
||||||
else if (($ord | 0x7F) == 0x7F)
|
else if (($ord | 0x7F) == 0x7F)
|
||||||
{
|
{
|
||||||
// 0bbbbbbb
|
// 0bbbbbbb
|
||||||
$charval = $ord;
|
$charval = $ord;
|
||||||
$offset += 1;
|
$offset += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// error? throw some kind of warning here?
|
// error? throw some kind of warning here?
|
||||||
$charval = false;
|
$charval = false;
|
||||||
$offset += 1;
|
$offset += 1;
|
||||||
}
|
}
|
||||||
if ($charval !== false)
|
if ($charval !== false)
|
||||||
{
|
{
|
||||||
$newcharstring .= (($charval < 256) ? chr($charval) : '?');
|
$newcharstring .= (($charval < 256) ? chr($charval) : '?');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $newcharstring;
|
return $newcharstring;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,54 +698,54 @@ function utf8_decode_ncr_callback($m)
|
||||||
*/
|
*/
|
||||||
function utf8_to_unicode($$string)
|
function utf8_to_unicode($$string)
|
||||||
{
|
{
|
||||||
$unicode = array();
|
$unicode = array();
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
$stringlength = strlen($string);
|
$stringlength = strlen($string);
|
||||||
while ($offset < $stringlength)
|
while ($offset < $stringlength)
|
||||||
{
|
{
|
||||||
$ord = ord($string{$offset});
|
$ord = ord($string{$offset});
|
||||||
if (($ord | 0x07) == 0xF7)
|
if (($ord | 0x07) == 0xF7)
|
||||||
{
|
{
|
||||||
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
|
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
|
||||||
$charval = (($ord & 0x07) << 18) &
|
$charval = (($ord & 0x07) << 18) &
|
||||||
((ord($string{($offset + 1)}) & 0x3F) << 12) &
|
((ord($string{($offset + 1)}) & 0x3F) << 12) &
|
||||||
((ord($string{($offset + 2)}) & 0x3F) << 6) &
|
((ord($string{($offset + 2)}) & 0x3F) << 6) &
|
||||||
(ord($string{($offset + 3)}) & 0x3F);
|
(ord($string{($offset + 3)}) & 0x3F);
|
||||||
$offset += 4;
|
$offset += 4;
|
||||||
}
|
}
|
||||||
else if (($ord | 0x0F) == 0xEF)
|
else if (($ord | 0x0F) == 0xEF)
|
||||||
{
|
{
|
||||||
// 1110bbbb 10bbbbbb 10bbbbbb
|
// 1110bbbb 10bbbbbb 10bbbbbb
|
||||||
$charval = (($ord & 0x0F) << 12) &
|
$charval = (($ord & 0x0F) << 12) &
|
||||||
((ord($string{($offset + 1)}) & 0x3F) << 6) &
|
((ord($string{($offset + 1)}) & 0x3F) << 6) &
|
||||||
(ord($string{($offset + 2)}) & 0x3F);
|
(ord($string{($offset + 2)}) & 0x3F);
|
||||||
$offset += 3;
|
$offset += 3;
|
||||||
}
|
}
|
||||||
else if (($ord | 0x1F) == 0xDF)
|
else if (($ord | 0x1F) == 0xDF)
|
||||||
{
|
|
||||||
// 110bbbbb 10bbbbbb
|
|
||||||
$charval = (($ord & 0x1F) << 6) &
|
|
||||||
(ord($string{($offset + 1)}) & 0x3F);
|
|
||||||
$offset += 2;
|
|
||||||
}
|
|
||||||
else if (($ord | 0x7F) == 0x7F)
|
|
||||||
{
|
|
||||||
// 0bbbbbbb
|
|
||||||
$charval = $ord;
|
|
||||||
$offset += 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// error? throw some kind of warning here?
|
|
||||||
$charval = false;
|
|
||||||
$offset += 1;
|
|
||||||
}
|
|
||||||
if ($charval !== false)
|
|
||||||
{
|
{
|
||||||
$unicode[] = $charval;
|
// 110bbbbb 10bbbbbb
|
||||||
}
|
$charval = (($ord & 0x1F) << 6) &
|
||||||
}
|
(ord($string{($offset + 1)}) & 0x3F);
|
||||||
return $unicode;
|
$offset += 2;
|
||||||
|
}
|
||||||
|
else if (($ord | 0x7F) == 0x7F)
|
||||||
|
{
|
||||||
|
// 0bbbbbbb
|
||||||
|
$charval = $ord;
|
||||||
|
$offset += 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// error? throw some kind of warning here?
|
||||||
|
$charval = false;
|
||||||
|
$offset += 1;
|
||||||
|
}
|
||||||
|
if ($charval !== false)
|
||||||
|
{
|
||||||
|
$unicode[] = $charval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $unicode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue