[wp-trac] [WordPress Trac] #62354: fetch_feed should use `get_bloginfo( 'charset' )` over `get_option( 'blog_charset' )` when setting the output encoding

WordPress Trac noreply at wordpress.org
Mon Aug 25 22:54:08 UTC 2025


#62354: fetch_feed should use `get_bloginfo( 'charset' )` over `get_option(
'blog_charset' )` when setting the output encoding
-------------------------------------------------+-------------------------
 Reporter:  david.binda                          |       Owner:  desrosj
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.7
Component:  Feeds                                |     Version:  6.7
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  dev-reviewed                                   |
-------------------------------------------------+-------------------------

Comment (by dmsnell):

 It seems like `get_bloginfo( 'charset' )` and `get_option( 'blog_charset'
 )` should both default to `UTF-8` and I would have expected the additional
 checks deep down not to be necessary.

 is there some reason these both failed to return `UTF-8`? do we want to
 address it as special cases in those functions so that calling code
 needn’t reproduce the internal logic?

 [https://github.com/WordPress/wordpress-
 develop/blob/1ab39ce269a0dd718f6e547162403c5eb11219ba/src/wp-includes
 /general-template.php#L871 wp-includes/general-template.php#L871]

 {{{#!php
 <?php
 function get_bloginfo( $show = '', $filter = 'raw' ) {
         ...
         'blog_charset'                    => 'UTF-8',
 }}}

 [https://github.com/WordPress/wordpress-
 develop/blob/1ab39ce269a0dd718f6e547162403c5eb11219ba/src/wp-
 admin/includes/schema.php#L445 wp-admin/includes/schema.php#L445]

 {{{#!php
 <?php
 function populate_options( array $options = array() ) {
         ...
                 case 'charset':
                         $output = get_option( 'blog_charset' );
                         if ( '' === $output ) {
                                 $output = 'UTF-8';
                         }
                         break;
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62354#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list