1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 15:16:16 +02:00

recode_basic and recode_cjk (this one is most probably not within the full release but available seperatly due to it's sheer size) for converting to utf8

git-svn-id: file:///svn/phpbb/trunk@6845 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-01-06 19:23:23 +00:00
parent e1b549a967
commit 962be6ed09
3 changed files with 46293 additions and 12 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -771,11 +771,11 @@ function utf8_recode($string, $encoding)
case '874':
if (!function_exists('cp' . $array[1]))
{
if (!file_exists($phpbb_root_path . 'includes/utf/data/basic.' . $phpEx))
if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx))
{
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/recode_basic.' . $phpEx);
}
return call_user_func('cp' . $array[1], $string);
break;
@ -799,11 +799,11 @@ function utf8_recode($string, $encoding)
case '15':
if (!function_exists('iso_8895_' . $array[1]))
{
if (!file_exists($phpbb_root_path . 'includes/utf/data/basic.' . $phpEx))
if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx))
{
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/recode_basic.' . $phpEx);
}
return call_user_func('iso_8895_' . $array[1], $string);
break;
@ -819,11 +819,11 @@ function utf8_recode($string, $encoding)
{
if (!function_exists('sjis'))
{
if (!file_exists($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx))
if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx))
{
trigger_error('CJK reencoder file is missing', E_USER_ERROR);
}
include($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx);
include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx);
}
return sjis($string);
}
@ -833,11 +833,11 @@ function utf8_recode($string, $encoding)
{
if (!function_exists('euc_kr'))
{
if (!file_exists($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx))
if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx))
{
trigger_error('CJK reencoder file is missing', E_USER_ERROR);
}
include($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx);
include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx);
}
return euc_kr($string);
}
@ -847,11 +847,11 @@ function utf8_recode($string, $encoding)
{
if (!function_exists('big5'))
{
if (!file_exists($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx))
if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx))
{
trigger_error('CJK reencoder file is missing', E_USER_ERROR);
}
include($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx);
include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx);
}
return big5($string);
}
@ -861,11 +861,11 @@ function utf8_recode($string, $encoding)
{
if (!function_exists('gb2312'))
{
if (!file_exists($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx))
if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx))
{
trigger_error('CJK reencoder file is missing', E_USER_ERROR);
}
include($phpbb_root_path . 'includes/utf/data/cjk.' . $phpEx);
include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx);
}
return gb2312($string);
}
@ -1127,4 +1127,28 @@ function utf8_htmlspecialchars(&$value)
return htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
}
/**
* Trying to convert returned system message to utf8
function utf8_convert_message($message)
{
// First of all check if conversion is possible/needed
if (empty($_SERVER['HTTP_ACCEPT_CHARSET']) || !preg_match('/[\x80-\xFF]/', $message))
{
return htmlspecialchars($message);
}
// Guess the encoding. Because it is used for system messages we check the system/server.
$encoding = explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']);
$encoding = (empty($encoding)) ? array() : explode(';', $encoding[0]);
$encoding = (empty($encoding)) ? false : trim(strtolower($encoding[0]));
if (empty($encoding) || $encoding == 'utf-8')
{
return utf8_htmlspecialchars($message);
}
return utf8_htmlspecialchars(utf8_recode($message, $encoding));
}
*/
?>