Merge lp:~porten-deactivatedaccount/eventum/devel into lp:eventum

Proposed by Harri Porten
Status: Merged
Merged at revision: 4263
Proposed branch: lp:~porten-deactivatedaccount/eventum/devel
Merge into: lp:eventum
Diff against target: 13 lines (+3/-0)
1 file modified
lib/eventum/class.mime_helper.php (+3/-0)
To merge this branch: bzr merge lp:~porten-deactivatedaccount/eventum/devel
Reviewer Review Type Date Requested Status
Eventum Development Team Pending
Review via email: mp+47336@code.launchpad.net

Description of the change

When decoding text encoded based on RFC 2047 the charset parameter was ignored completely. Consequently we found some fields in the GUI to display garbled content.

To post a comment you must log in.
Revision history for this message
Elan Ruusamäe (glen666) wrote :

applied, but this Mime_Helper::fixEncoding is just mime header decode?

i.e. could be replaced just with call to:
http://php.net/manual/en/function.iconv-mime-decode.php

and, do you have test strings to be included to testsuite (the ones i didn't already cover)?

4263. By Elan Ruusamäe

Respect charset when processing Mime_Helper::fixEncoding

merge request https://code.launchpad.net/~porten/eventum/devel/+merge/47336

Revision history for this message
Harri Porten (porten-deactivatedaccount) wrote :

I agree with the assessment that a standard function can be used. We just
did not dare to make bigger changes we had to fix a regression that
occurred when we converted our database to utf-8 encoding.

Unlike your tests our concrete case had 'Q' encoding and a koi8-r charset.
But not fundamentally different.

Btw: one of the iconv_mime_decode() calls in that class is guarded by
function_exists(). The iconv availability is a hard requirement these
days?

Revision history for this message
Elan Ruusamäe (glen666) wrote :

iconv + mbstring should be made hard requirement, currently setup allows them as soft dependencies
but i've seen a lot of places falling back to something else if ext is missing.

so that's some cleanup to do

also, the fixEncoding should no longer be used:
http://bazaar.launchpad.net/~eventum-developers/eventum/trunk/revision/4268

Revision history for this message
Elan Ruusamäe (glen666) wrote :

seems something got broken still

i'm having APP_CHARSET utf8, and such email header:

"Subject: =?iso-8859-15?Q?n=FC=FCd_ei_t=F6=F6ta_adminni_publish_nupp_?="

was decoded as:
"nd ei tta adminni publish nupp "

need to debug this

Revision history for this message
Elan Ruusamäe (glen666) wrote :

seems iconv_mime_decode corrupts data if it is not qp encoded (or already decoded)

Committed revision 4283 with fix.

Revision history for this message
Elan Ruusamäe (glen666) wrote :

sorry Committed revision 4282 (my branch diverted, so the revno changed)

Revision history for this message
Harri Porten (porten-deactivatedaccount) wrote :

On Tue, 1 Feb 2011, Elan Ruusamäe wrote:

> seems iconv_mime_decode corrupts data if it is not qp encoded (or already decoded)

That is what we recall seeing as well. Hence we had simply left the
original function intact besides our fix.

Harri.

Revision history for this message
Elan Ruusamäe (glen666) wrote :

Too bad you didn't bother reporting it then, would had known fixEncoding and decodeQuotedPrintable were not identical by the behaviour, i.e would had made the fix earlier.

Revision history for this message
Harri Porten (porten-deactivatedaccount) wrote :

On Tue, 1 Feb 2011, Elan Ruusamäe wrote:

> Too bad you didn't bother reporting it then, would had known fixEncoding
> and decodeQuotedPrintable were not identical by the behaviour, i.e would
> had made the fix earlier.

Sorry. I think I mentioned it on the #eventum IRC channel. But our memory
on this was really too vague to make it a statement.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/eventum/class.mime_helper.php'
2--- lib/eventum/class.mime_helper.php 2010-12-09 12:06:24 +0000
3+++ lib/eventum/class.mime_helper.php 2011-01-25 00:12:50 +0000
4@@ -151,6 +151,9 @@
5 $text = str_replace('='.$value, chr(hexdec($value)), $text);
6 break;
7 }
8+ if (!empty($charset)) {
9+ $text = iconv($charset, APP_CHARSET, $text);
10+ }
11 $input = str_replace($encoded, $text, $input);
12 }
13 return $input;

Subscribers

People subscribed via source and target branches