• Resolved Bruno Chériaux

    (@brunoeficiens)


    Hi,
    Lets say that I create a category named “L’essentiel”.
    The apostrophe is replaced with & rsquo; and the feed looks like:
    <title>L& rsquo;essentiel & #8211; Sitename</title>

    But this is not a valid RSS Feed according to https://validator.w3.org/feed
    If I replace the apostrophe with & #8217; in the category name, it works:
    <title>L& #8217;essentiel & #8211; Sitename</title>

    Is it possible to change encoding technic for HTML special chars?
    Thanks

    *note that I added a space after the & sign to prevent wordpress forum from replacing chars

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Bruno,

    For the title, GN Publisher calls wp_title_rss()

    I’m a little hesitant to change the default behavior of how WP outputs the title.

    When you ran it through the RSS Validator, did it flag it as an error (not valid) or a warning?

    Chris

    Thread Starter Bruno Chériaux

    (@brunoeficiens)

    Hi Chris,
    Thank you for your answer.
    The validator returns an error (not valid) at line 10 when “& apos;” is used in de <title> tag.
    To avoid this issue, I have renamed the category name in the WP admin: I replaced the apostrophe with “& #8217;”.

    Are you comfortable with that as a solution, or would you like me to continue investigating other potential solutions?

    Apparently not very many publishers have apostrophes included in the category name, since this has never come up before ??

    Chris

    Thread Starter Bruno Chériaux

    (@brunoeficiens)

    Hi Chris,
    I’ve investigated more and find out that if I set a title with the ‘ char (char code #39), WP replaces it with an ’ (char code #8217) and encodes it with HTML entity name ‘rsquo’ in “get_wp_title_rss” function.
    So I wrote a filter :

    add_filter('document_title', function($title){
    	$title = str_replace(['’', '& rsquo;'], ['& #8217;', '& #8217;'], $title);
    	return $title;
    });

    This patch works for me and I don’t need a plugin evolution.

    Note that I use WordPress in French.

    Awesome – yep, I was thinking along the same lines as a potential solution! Thanks for working this out and sharing,

    Chris

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Feed validation fails if category name contains an apostrophe’ is closed to new replies.