aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/utf/utf_tools.php
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2007-01-07 04:24:08 +0000
committerDavid M <davidmj@users.sourceforge.net>2007-01-07 04:24:08 +0000
commita643f85f6b33f8e0a8a30b5eb6696a40b78e2abd (patch)
tree24b843100c6ab913e3b01e11d2157d55b388bfde /phpBB/includes/utf/utf_tools.php
parentf3b514368210c7d0328d5aeaf70341bd082a06f3 (diff)
downloadforums-a643f85f6b33f8e0a8a30b5eb6696a40b78e2abd.tar
forums-a643f85f6b33f8e0a8a30b5eb6696a40b78e2abd.tar.gz
forums-a643f85f6b33f8e0a8a30b5eb6696a40b78e2abd.tar.bz2
forums-a643f85f6b33f8e0a8a30b5eb6696a40b78e2abd.tar.xz
forums-a643f85f6b33f8e0a8a30b5eb6696a40b78e2abd.zip
- prefer ISO over CP as ISO is more common
- added TIS-620 and cp-1251 git-svn-id: file:///svn/phpbb/trunk@6849 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/utf/utf_tools.php')
-rw-r--r--phpBB/includes/utf/utf_tools.php59
1 files changed, 37 insertions, 22 deletions
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index 39868f71e9..ec233cf986 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -756,20 +756,18 @@ function utf8_recode($string, $encoding)
global $phpbb_root_path, $phpEx;
- // CP/WIN character encoding
- if (preg_match('/(?:cp|windows)[_\- ]?(\\d+)/', $encoding, $array))
+ // iso-8859-* character encoding
+ if (preg_match('/iso[_ -]?8859[_ -]?(\\d+)/', $encoding, $array))
{
switch ($array[1])
{
- case '932':
- break;
- case '1250':
- case '1254':
- case '1255':
- case '1256':
- case '1257':
- case '874':
- if (!function_exists('cp' . $array[1]))
+ case '1':
+ case '2':
+ case '4':
+ case '7':
+ case '9':
+ case '15':
+ if (!function_exists('iso_8895_' . $array[1]))
{
if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx))
{
@@ -777,7 +775,7 @@ function utf8_recode($string, $encoding)
}
include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx);
}
- return call_user_func('cp' . $array[1], $string);
+ return call_user_func('iso_8895_' . $array[1], $string);
break;
default:
@@ -786,18 +784,21 @@ function utf8_recode($string, $encoding)
}
}
- // iso-8859-* character encoding
- if (preg_match('/iso[_ -]?8859[_ -]?(\\d+)/', $encoding, $array))
+ // CP/WIN character encoding
+ if (preg_match('/(?:cp|windows)[_\- ]?(\\d+)/', $encoding, $array))
{
switch ($array[1])
{
- case '1':
- case '2':
- case '4':
- case '7':
- case '9':
- case '15':
- if (!function_exists('iso_8895_' . $array[1]))
+ case '932':
+ break;
+ case '1250':
+ case '1251':
+ case '1254':
+ case '1255':
+ case '1256':
+ case '1257':
+ case '874':
+ if (!function_exists('cp' . $array[1]))
{
if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx))
{
@@ -805,7 +806,7 @@ function utf8_recode($string, $encoding)
}
include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx);
}
- return call_user_func('iso_8895_' . $array[1], $string);
+ return call_user_func('cp' . $array[1], $string);
break;
default:
@@ -814,6 +815,20 @@ function utf8_recode($string, $encoding)
}
}
+ // TIS-620
+ if (preg_match('/tis[_ -]?620/', $encoding))
+ {
+ if (!function_exists('tis_620'))
+ {
+ 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/recode_basic.' . $phpEx);
+ }
+ return tis_620($string);
+ }
+
// SJIS
if (preg_match('/sjis(?:[_ -]?win)?|(?:cp|ibm)[_ -]?932|shift[_ -]?jis/', $encoding))
{