6.0.0-git
2019-03-22

[#9020] Subject charset problem
Summary Subject charset problem
Queue IMP
Queue Version 4.3.7
Type Bug
State Not A Bug
Priority 2. Medium
Owners
Requester george (at) polarismail (dot) com
Created 2010-05-12 (3236 days ago)
Due
Updated 2010-05-15 (3233 days ago)
Assigned
Resolved 2010-05-12 (3236 days ago)
Milestone
Patch No

History
2010-05-15 17:24:08 george (at) polarismail (dot) com Comment #8 Reply to this comment
As it turns out, the issue was only half fixed - not sure why. Some 
messages were now showing fine while others still had question marks.

I started looking and finally traced it down to: imp/lib/IMAP/MessageCache.php

where the function retrieve that gets the subject ( and other header 
pieces ) says... :
                     // There should not be any 8bit characters here.  If there
                     // is, we either need to convert from the default charset
                     // or replace with question marks.


The line that verifies if I have a default charset is this:
if (!empty($GLOBALS['mime_headers']['default_charset'])) {

but my default_charset was empty even though it was setup in 
imp/config/prefs.php - not sure why. This is a stock installation of 
the latest Horde Webmail Groupware edition.

I simply added above that line, the following:
$GLOBALS['mime_headers']['default_charset']="US-ASCII";

and now finally all the subjects are showing fine.

The two issues were:

#1. UTF8 encoding in the subject line
#2. missing default charset in IMP


2010-05-15 16:02:52 george (at) polarismail (dot) com Comment #7 Reply to this comment

[Show Quoted Text - 27 lines]
I just realized that encoding the subject to UTF8 also fixes the 
NLS::getCharset() 'bug' I noticed earlier. Since the subject is 
already UTF8 there's no need to have that function return ISO-8859-1

The modified line in mailbox.php simply has to look like:

$msg['subject'] = utf8_encode($imp_ui->getSubject($ob->subject));



2010-05-15 15:56:16 george (at) polarismail (dot) com Comment #6 Reply to this comment
It could also be the imap server's fault. If you need more support, 
please ask on the mailing list.
Hi Jan,

I just fixed the issue by adding the following in mailbox.php at line 737:
$msg['subject']=utf8_encode($msg['subject']); right after

$msg['subject'] = $imp_ui->getSubject($ob->subject);


the code now looks like:
if (!empty($ob->subject)) {
         $msg['subject'] = $imp_ui->getSubject($ob->subject);
         $msg['subject']=utf8_encode($msg['subject']);
     }

this effectively solves the problem and displays the characters 
properly. Can you confirm if this is just a bug on our systems ( and 
therefore we should make a note of it and update IMP ourselves ) or if 
it's a general issue with IMP that will be fixed in future releases ?

We also had a very hard time with subjects encoded with ISO-8859. I 
submitted more info to the mailing list but basically the solution was 
to have NLS::getCharset return ISO-8859-1 instead of UTF-8

2010-05-13 15:23:09 Jan Schneider Comment #5 Reply to this comment
It could also be the imap server's fault. If you need more support, 
please ask on the mailing list.
2010-05-13 04:57:41 george (at) polarismail (dot) com Comment #4 Reply to this comment
I just updated to version 2007e of the c-client library and the same 
problem occurs.
2010-05-13 04:26:14 george (at) polarismail (dot) com Comment #3 Reply to this comment
We are running the following: php-5.3.2

with this extension:

IMAP c-Client Version        2006j

Is this a known bug in the IMAP c-Client extension ?

2010-05-12 16:54:01 Jan Schneider Comment #2
State ⇒ Not A Bug
Reply to this comment
If it works in the message view, but not in the mailbox view, then 
your c-client library (imap extension of PHP) is returning incorrect 
data.
2010-05-12 16:01:55 george (at) polarismail (dot) com Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ Subject charset problem
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
Reply to this comment
Subjects for messages containing foreign characters are either not 
display at all or show an '?' instead of the character. This is only 
true in the Folder display window - where I see all my messages along 
with their subjects.

When I open the actual message, the subject shows fine with the proper 
characters.

Examples of words include:
Tecnológica  , displays as: Tecnol?gica
dólar , displays nothing at all. empty subject line

I checked the html source and there really is nothing where the 
subject is supposed to be. However, when I open the message the 
subject is properly there.

Thank you!


Saved Queries