[ php-blog-Bugs-2831116 ] POPfetcher Charset Conversion Badly Broken

"SourceForge.net" <[email protected]> Wed, 05 Aug 2009 09:59:58 +0000
Newsgroups gmane.comp.serendipity.trackers
Message-ID <[email protected]>
Bugs item #2831116, was opened at 2009-08-02 12:19
Message generated for change (Comment added) made by garvinhicking
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=542822&aid=2831116&group_id=75065

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Plugins
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: B.Tittelbach (btittelbach)
Assigned to: Nobody/Anonymous (nobody)
Summary: POPfetcher Charset Conversion Badly Broken

Initial Comment:
Tested with Serendipity 1.4.1, downloaded newest POPfetcher Plugin with Spartacus.

Problem: Character Conversion of e-mails is not implemented correctly. Only works with latin1 <-> utf-8.
the php Functions utf8_en/decode($string) are used, which only de/encodes latin1 to/from utf8.

Instead, depending on avaible php extension, the following should be used:

in PHP6:
function decode($string, $charset) {
            return unicode_decode($string,$charset);
}

in PHP4/5 with iconv compiled in:
function decode($string, $charset) {
            $destcc=LANG_CHARSET;
            if (!empty($destcc)) $destcc="utf-8";
            return iconv($charset,$destcc,$string);   
}

in PHP4/5 with recodelib extension enabled:
function decode($string, $charset) {
            $destcc=LANG_CHARSET;
            if (!empty($destcc)) $destcc="utf-8";
            return recode_string("$charset..$destcc",$string);
}

utf8_en/decode can _only_ be used if latin1<->utf-8 conversion is needed. Otherwise an error should be thrown.

----------------------------------------------------------------------

>Comment By: Garvin Hicking (garvinhicking)
Date: 2009-08-05 09:59

Message:
Hi!

Can you give a description of your setup where you faced the bug? Which
charset did you configure for serendipity, and in which charset was your
mail?

The mimeDecode library also translates the charsets, AFAIK - so what I
have in mind was that it takes care of always either supplying latin1 or
UTF-8 content. If that's not the case, I'd like to setup an installation
that matches your to investigate the issue properly.

Thanks,
Garvin

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=542822&aid=2831116&group_id=75065

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july