[wp-trac] [WordPress Trac] #11219: SimplePie fails when trying to convert UTF-8 to UTF-8

WordPress Trac wp-trac at lists.automattic.com
Sat Nov 21 12:29:48 UTC 2009


#11219: SimplePie fails when trying to convert UTF-8 to UTF-8
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:           
     Type:  defect (bug)       |      Status:  new      
 Priority:  normal             |   Milestone:  2.9      
Component:  Administration     |     Version:  2.9      
 Severity:  normal             |    Keywords:  has-patch
-------------------------------+--------------------------------------------

Comment(by Denis-de-Bernardy):

 Basically, the problem is this loop:

 {{{
                         // Loop through each possible encoding, till we
 return something, or run out of possibilities
                         foreach ($encodings as $encoding)
                         {
                                 // Change the encoding to UTF-8 (as we
 always use UTF-8 internally)
                                 if ($utf8_data =
 SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8'))
                                 {
                                         // Create new parser
                                         $parser =& new
 $this->parser_class();
 ...
                         if(isset($parser))
                         {
                                 // We have an error, just set
 SimplePie_Misc::error to it and quit
                                 $this->error = sprintf('XML error: %s at
 line %d, column %d', $parser->get_error_string(),
 $parser->get_current_line(), $parser->get_current_column());
                         }
                         else
                         {
                                 $this->error = 'The data could not be
 converted to UTF-8';
                         }
 }}}

 and then change_encoding() doesn't check if it needs to convert nothing at
 all. and it ends up returning false.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11219#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list