[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 Nov 11 17:11:49 UTC 2024
#62354: fetch_feed should use `get_bloginfo( 'charset' )` over `get_option(
'blog_charset' )` when setting the output encoding
--------------------------------------+---------------------
Reporter: david.binda | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.7
Component: Feeds | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+---------------------
Comment (by desrosj):
Replying to [comment:5 azaozz]:
> An alternative (perhaps a bit safer?) patch would be to hard-code this
[https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/feed.php?rev=59241&marks=845#L845 directly] in `fetch_feed()`.
Replace `$feed->set_output_encoding( get_option( 'blog_charset' ) );`
with:
>
> {{{
> $blog_charset = get_option( 'blog_charset' );
>
> if ( empty( $blog_charset ) ) {
> $blog_charset = 'UTF-8';
> }
>
> $feed->set_output_encoding( $blog_charset );
> }}}
I think that I'd prefer to just switch to `get_bloginfo( 'charset' )`.
This fallback snippet almost exactly matches the code in the `charset`
case within `get_bloginfo()`, and I don't see any compelling reason to
have duplicate code.
I've been able to reproduce the problem with @davidbinda's latest
feedback. You can see the new test class failing here:
https://github.com/WordPress/wordpress-develop/actions/runs/11782905557.
Working to add a real assertion and to confirm the proposed fix resolves
the problem.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62354#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list