From: ealtin at casdb dot com Operating system: Debian/unstable PHP version: 4.3.9 PHP Bug Type: IMAP related Bug description: imap_utf8() incorrectly converts when used in conjunction with setlocale()
Description: ------------ imap_utf8() incorrectly converts when used in conjunction with setlocale(). I'm working on a Webmail application, which uses gettext for localization and depends on IMAP extension. The output is always UTF-8, so I don't need to mess with charset conversions too much. I'm using imap_utf8() to convert the subject/sender/CC information correctly, directly to UTF8. It works well, unless I'm setting current locale with say, en_US.UTF-8. Then it converts to some 8bit charset even if it's supposed to output UTF-8. Would be easy to reproduce, but you'd need some weird subject line, like this one: Reproduce code: --------------- setlocale(LC_ALL, "en_US.UTF-8"); echo imap_utf8("(IH#: 5176) Re: =?ISO-8859-9?Q?=FCr=FCn=FC_h=FDzl=FD_sat=FDn?==?ISO-8859-9?Q?_al_dedi=F0im_zaman_?="); Expected result: ---------------- setlocale(LC_ALL, "POSIX"); echo imap_utf8("(IH#: 5176) Re: =?ISO-8859-9?Q?=FCr=FCn=FC_h=FDzl=FD_sat=FDn?==?ISO-8859-9?Q?_al_dedi=F0im_zaman_?="); -- Edit bug report at http://bugs.php.net/?id=30546&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30546&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30546&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30546&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30546&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30546&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30546&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30546&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30546&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30546&r=support Expected behavior: http://bugs.php.net/fix.php?id=30546&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30546&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30546&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30546&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30546&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30546&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30546&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30546&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30546&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30546&r=mysqlcfg