aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/utf/utf_tools.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-01-06 19:23:23 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-01-06 19:23:23 +0000
commit962be6ed09bc19bb255e3e9bbe0194831a922f5c (patch)
tree88f5ce77653a04e68f8a34ec310b4db16b3004d7 /phpBB/includes/utf/utf_tools.php
parente1b549a96766b33b8ae779a82f4442413c94a904 (diff)
downloadforums-962be6ed09bc19bb255e3e9bbe0194831a922f5c.tar
forums-962be6ed09bc19bb255e3e9bbe0194831a922f5c.tar.gz
forums-962be6ed09bc19bb255e3e9bbe0194831a922f5c.tar.bz2
forums-962be6ed09bc19bb255e3e9bbe0194831a922f5c.tar.xz
forums-962be6ed09bc19bb255e3e9bbe0194831a922f5c.zip
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
Diffstat (limited to 'phpBB/includes/utf/utf_tools.php')
-rw-r--r--phpBB/includes/utf/utf_tools.php48
1 files changed, 36 insertions, 12 deletions
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index c3c15b2c3b..d6d5235883 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -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));
+}
+*/
+
?> \ No newline at end of file