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

"SourceForge.net" <[email protected]> Sun, 02 Aug 2009 12:19:11 +0000
Newsgroups gmane.comp.serendipity.trackers
Message-ID <[email protected]>
Bugs item #2831116, was opened at 2009-08-02 14:19
Message generated for change (Tracker Item Submitted) made by btittelbach
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.

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

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