X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_utf7_local.php;h=6bb597cd69b1080d7711f9cfefda086aa6d96d53;hb=df788686f6da78b103a6eca0ef45b663ad0ae66c;hp=5478ea6b35827c5780aed2ad2caa8905ef8f7d3d;hpb=02d0931e252ee41e99b63fc740195f78f1e3bbe0;p=squirrelmail.git diff --git a/functions/imap_utf7_local.php b/functions/imap_utf7_local.php index 5478ea6b..6bb597cd 100644 --- a/functions/imap_utf7_local.php +++ b/functions/imap_utf7_local.php @@ -3,22 +3,30 @@ /** * imap_utf7_local.php * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 1999-2004 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This implements all functions that do imap UTF7 conversions. * * $Id$ + * @package squirrelmail */ +/** + * @param string $str + * @param string $to_encoding + * @param string $from_encoding + * @param string $default_charset + * @return string + */ function sqimap_mb_convert_encoding($str, $to_encoding, $from_encoding, $default_charset) { // Allows mbstring functions only with iso-8859-*, utf-8 and // iso-2022-jp (Japanese) // koi8-r and gb2312 can be added only in php 4.3+ - if ( stristr('iso-8859-',$default_charset) || - stristr('utf-8',$default_charset) || - stristr('iso-2022-jp',$default_charset) ) { + if ( stristr($default_charset, 'iso-8859-') || + stristr($default_charset, 'utf-8') || + stristr($default_charset, 'iso-2022-jp') ) { if (function_exists('mb_convert_encoding')) { return mb_convert_encoding($str, $to_encoding, $from_encoding); } @@ -91,8 +99,8 @@ function imap_utf7_decode_local($s) { return ''; global $default_charset; - set_my_charset(); - if (strtolower($default_charset) != 'iso-8859-1') { + set_my_charset(); //must be called before using $default_charset + if ((strtolower($default_charset) != 'iso-8859-1') && ($default_charset != '')) { $utf7_s = sqimap_mb_convert_encoding($s, $default_charset, 'UTF7-IMAP', $default_charset); if ($utf7_s != '') return $utf7_s; @@ -214,4 +222,4 @@ function decodeBASE64($s) { return $d; } -?> \ No newline at end of file +?>