[wp-trac] [WordPress Trac] #4984: Bug in RSS Widget
WordPress Trac
wp-trac at lists.automattic.com
Sun Sep 16 00:17:19 GMT 2007
#4984: Bug in RSS Widget
----------------------------+-----------------------------------------------
Reporter: camilohollanda | Owner: widgets
Type: task | Status: new
Priority: normal | Milestone: 2.2.3
Component: General | Version:
Severity: normal | Keywords: widgets, utf, iso
----------------------------+-----------------------------------------------
Widget for RSS dont identify correct coding of RSS imported. It mantains
the same coding of original RSS. As I use UTF-8 in my site, ISO RSS will
be corrupted. So I adapted my widgets.php
function detectUTF8($string) {
return preg_match('%(?:
[\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
|\xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
|\xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
|\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
|[\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
|\xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)+%xs', $string);
}
if(!detectUTF8($desc)) { $desc = utf8_encode($desc); }
if(!detectUTF8($summary)) { $summary = utf8_encode($summary); }
if(!detectUTF8($title)) { $title = utf8_encode($title); }
But I think that ideal would be that widgets could convert RSS to the
coding of choice in the Options menu of Admin. In my case, UTF.
Sorry for my poor english,
Camilo
--
Ticket URL: <http://trac.wordpress.org/ticket/4984>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list