aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/utf
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2007-02-18 21:03:36 +0000
committerDavid M <davidmj@users.sourceforge.net>2007-02-18 21:03:36 +0000
commit0350eb9f3ca0f7f239ae868afef4e7765a22833b (patch)
tree68046a30da28b984f0fa84794f657bf7cd2292ad /phpBB/includes/utf
parent5c6653717f0a9adce905d1417c8adb4f0f3a5b73 (diff)
downloadforums-0350eb9f3ca0f7f239ae868afef4e7765a22833b.tar
forums-0350eb9f3ca0f7f239ae868afef4e7765a22833b.tar.gz
forums-0350eb9f3ca0f7f239ae868afef4e7765a22833b.tar.bz2
forums-0350eb9f3ca0f7f239ae868afef4e7765a22833b.tar.xz
forums-0350eb9f3ca0f7f239ae868afef4e7765a22833b.zip
- PHP4's mbstring is stupid stupid stupid
git-svn-id: file:///svn/phpbb/trunk@7008 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/utf')
-rw-r--r--phpBB/includes/utf/utf_tools.php24
1 files changed, 20 insertions, 4 deletions
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index 9ab31e60e4..4c5b4a8983 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -728,11 +728,27 @@ function utf8_recode($string, $encoding)
// Try the mb_string extension
if (function_exists('mb_convert_encoding'))
{
- $ret = @mb_convert_encoding($string, 'utf-8', $encoding);
-
- if (!empty($ret))
+ // mbstring is nasty on PHP4, we must make *sure* that we send a good encoding
+ switch ($encoding)
{
- return $ret;
+ case 'iso-8859-1':
+ case 'iso-8859-2':
+ case 'iso-8859-4':
+ case 'iso-8859-7':
+ case 'iso-8859-9':
+ case 'iso-8859-15':
+ case 'windows-1251':
+ case 'windows-1252':
+ case 'shift_jis':
+ case 'euc-kr':
+ case 'big5':
+ case 'gb2312':
+ $ret = @mb_convert_encoding($string, 'utf-8', $encoding);
+
+ if (!empty($ret))
+ {
+ return $ret;
+ }
}
}