|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: ealtin at casdb dot com
New email:
PHP Version: OS:


 [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 27 03:01:30 2024 UTC