|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30546 imap_utf8() incorrectly converts when used in conjunction with setlocale()
Submitted: 2004-10-24 14:04 UTC Modified: 2004-10-24 18:38 UTC
From: ealtin at casdb dot com Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 4.3.9 OS: Debian/unstable
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
4 + 5 = ?
Subscribe to this entry?

 [2004-10-24 14:04 UTC] ealtin at casdb dot com
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_?=");


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-24 18:38 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

This is a bug in the imap library, which is responsible for the conversion.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 12:01:33 2024 UTC