diff options
author | Nils Adermann <naderman@naderman.de> | 2007-01-07 00:44:15 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2007-01-07 00:44:15 +0000 |
commit | f3b514368210c7d0328d5aeaf70341bd082a06f3 (patch) | |
tree | 3a8ba3df71cd8a60d6dd05d2fa953bdc6fa59a6b /phpBB/includes/utf | |
parent | 5d91d463844a95db1afaffc87e6ce4a82b780f10 (diff) | |
download | forums-f3b514368210c7d0328d5aeaf70341bd082a06f3.tar forums-f3b514368210c7d0328d5aeaf70341bd082a06f3.tar.gz forums-f3b514368210c7d0328d5aeaf70341bd082a06f3.tar.bz2 forums-f3b514368210c7d0328d5aeaf70341bd082a06f3.tar.xz forums-f3b514368210c7d0328d5aeaf70341bd082a06f3.zip |
- Treat system messages as ISO-8859-1 just like PHP does it
git-svn-id: file:///svn/phpbb/trunk@6848 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/utf')
-rw-r--r-- | phpBB/includes/utf/utf_tools.php | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index d6d5235883..39868f71e9 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -1129,26 +1129,21 @@ function utf8_htmlspecialchars(&$value) /** * Trying to convert returned system message to utf8 +* +* PHP assumes such messages are ISO-8859-1 so we'll do that too +* and if it breaks messages we'll blame it on them ;-) +*/ 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') + // First of all check if conversion is neded at all, as there is no point + // in converting ASCII messages from ISO-8859-1 to UTF-8 + if (!preg_match('/[\x80-\xFF]/', $message)) { return utf8_htmlspecialchars($message); } - return utf8_htmlspecialchars(utf8_recode($message, $encoding)); + // else we need to convert some part of the message + return utf8_htmlspecialchars(utf8_recode($message, 'ISO-8859-1')); } -*/ ?>
\ No newline at end of file |