mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-06 14:35:56 +02:00
- added GB2312 support, made things nicer :D
git-svn-id: file:///svn/phpbb/trunk@6824 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
8914025c39
commit
ca7f397cd4
@ -757,7 +757,7 @@ function utf8_recode($string, $encoding)
|
|||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
// CP/WIN character encoding
|
// CP/WIN character encoding
|
||||||
if (preg_match('/(?:cp|win)[_\- ]?(\\d+)/i', $encoding, $array))
|
if (preg_match('/(?:cp|windows)[_\- ]?(\\d+)/', $encoding, $array))
|
||||||
{
|
{
|
||||||
switch ($array[1])
|
switch ($array[1])
|
||||||
{
|
{
|
||||||
@ -773,7 +773,7 @@ function utf8_recode($string, $encoding)
|
|||||||
{
|
{
|
||||||
if (!file_exists($phpbb_root_path . 'includes/utf/data/basic.' . $phpEx))
|
if (!file_exists($phpbb_root_path . 'includes/utf/data/basic.' . $phpEx))
|
||||||
{
|
{
|
||||||
trigger_error('Reencoder file is missing', E_USER_ERROR);
|
trigger_error('Basic reencoder file is missing', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
include($phpbb_root_path . 'includes/utf/data/basic.' . $phpEx);
|
include($phpbb_root_path . 'includes/utf/data/basic.' . $phpEx);
|
||||||
}
|
}
|
||||||
@ -815,7 +815,7 @@ function utf8_recode($string, $encoding)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SJIS
|
// SJIS
|
||||||
if (preg_match('/sjis(?:[_ -]?win)?|(?:cp|ibm)[_ -]?932|shift[_ -]?jis/i', $encoding))
|
if (preg_match('/sjis(?:[_ -]?win)?|(?:cp|ibm)[_ -]?932|shift[_ -]?jis/', $encoding))
|
||||||
{
|
{
|
||||||
if (!function_exists('sjis'))
|
if (!function_exists('sjis'))
|
||||||
{
|
{
|
||||||
@ -829,7 +829,7 @@ function utf8_recode($string, $encoding)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EUC_KR
|
// EUC_KR
|
||||||
if (preg_match('/euc[_ -]?kr/i', $encoding))
|
if (preg_match('/euc[_ -]?kr/', $encoding))
|
||||||
{
|
{
|
||||||
if (!function_exists('euc_kr'))
|
if (!function_exists('euc_kr'))
|
||||||
{
|
{
|
||||||
@ -843,7 +843,7 @@ function utf8_recode($string, $encoding)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BIG-5
|
// BIG-5
|
||||||
if (preg_match('/big[_ -]?5/i', $encoding))
|
if (preg_match('/big[_ -]?5/', $encoding))
|
||||||
{
|
{
|
||||||
if (!function_exists('big5'))
|
if (!function_exists('big5'))
|
||||||
{
|
{
|
||||||
@ -856,6 +856,20 @@ function utf8_recode($string, $encoding)
|
|||||||
return big5($string);
|
return big5($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GB2312
|
||||||
|
if (preg_match('/gb[_ -]?2312/', $encoding))
|
||||||
|
{
|
||||||
|
if (!function_exists('gb2312'))
|
||||||
|
{
|
||||||
|
if (!file_exists($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx))
|
||||||
|
{
|
||||||
|
trigger_error('CJK reencoder file is missing', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
include($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx);
|
||||||
|
}
|
||||||
|
return gb2312($string);
|
||||||
|
}
|
||||||
|
|
||||||
// Trigger an error?! Fow now just give bad data :-(
|
// Trigger an error?! Fow now just give bad data :-(
|
||||||
//trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR);
|
//trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR);
|
||||||
return $string;
|
return $string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user