admin管理员组

文章数量:1026989

I currently have a big apostrophes problem when my articles are published on my website, because for an example of a word like "l'associé", my article is published with characters that replace the apostrophe like on the image in attachment.

I specify that I use an automatic publishing plugin (using rss feeds) and oddly, when I post (manually) an article and that I add quotes there is no problem.

I checked the encoding of my database that was in utf8mb4 general but that I changed to utf8 general to see if I could solve my problem, but nothing changed, I also checked with notepad ++ if there was not one by checking that my file wp-config.php was not encoded in utf8 with bom, which usually creates accent problems in French.

So I suspect it could come from either the wordpress theme (Sahifa) or the plugin (wp-automatic) that publishes my articles from rss feeds.

Do you have a track that can guide me on the origin of the problem?

I currently have a big apostrophes problem when my articles are published on my website, because for an example of a word like "l'associé", my article is published with characters that replace the apostrophe like on the image in attachment.

I specify that I use an automatic publishing plugin (using rss feeds) and oddly, when I post (manually) an article and that I add quotes there is no problem.

I checked the encoding of my database that was in utf8mb4 general but that I changed to utf8 general to see if I could solve my problem, but nothing changed, I also checked with notepad ++ if there was not one by checking that my file wp-config.php was not encoded in utf8 with bom, which usually creates accent problems in French.

So I suspect it could come from either the wordpress theme (Sahifa) or the plugin (wp-automatic) that publishes my articles from rss feeds.

Do you have a track that can guide me on the origin of the problem?

Share Improve this question asked Mar 21, 2019 at 11:45 Frenchy_WPFrenchy_WP 191 silver badge6 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

This actually happens to me. I usually resolve this via string replace function. First one replaces the WordPress Content area. The second filter is replacing the Title area.

Check out the str_replace array and insert your œ to your own string before the $content array.

function replace_the_content_filter( $content ) {

    if ( is_single() )
    // Add image to the beginning of each page
    $content = str_replace(array('«','"', '“', '”'), '"', $content);

    // Returns the content.
    return $content;
}
add_filter( 'the_content', 'replace_the_content_filter', 20 );

function replace_the_title_filter( $content ) {

    // Add image to the beginning of each page
    $content = str_replace(array('«','"', '“', '”'), '"', $content);

    // Returns the content.
    return $content;
}
add_filter( 'the_title', 'replace_the_title_filter', 20 );

I hope that helps. Please be careful on the Title or Content section. If you wanna do it on Attachment title then check the https://developer.wordpress/reference/hooks/wp_get_attachment_caption/.

Goodluck.

Simpler still:

 function RemoveTheSlashes( $content ) 
    {
    $FixedContent = stripslashes($content);

     // Returns the content.
     return $FixedContent ;
   }
 add_filter( 'the_content', 'RemoveTheSlashes', 20 );

Will turn this: /' into just the '

I currently have a big apostrophes problem when my articles are published on my website, because for an example of a word like "l'associé", my article is published with characters that replace the apostrophe like on the image in attachment.

I specify that I use an automatic publishing plugin (using rss feeds) and oddly, when I post (manually) an article and that I add quotes there is no problem.

I checked the encoding of my database that was in utf8mb4 general but that I changed to utf8 general to see if I could solve my problem, but nothing changed, I also checked with notepad ++ if there was not one by checking that my file wp-config.php was not encoded in utf8 with bom, which usually creates accent problems in French.

So I suspect it could come from either the wordpress theme (Sahifa) or the plugin (wp-automatic) that publishes my articles from rss feeds.

Do you have a track that can guide me on the origin of the problem?

I currently have a big apostrophes problem when my articles are published on my website, because for an example of a word like "l'associé", my article is published with characters that replace the apostrophe like on the image in attachment.

I specify that I use an automatic publishing plugin (using rss feeds) and oddly, when I post (manually) an article and that I add quotes there is no problem.

I checked the encoding of my database that was in utf8mb4 general but that I changed to utf8 general to see if I could solve my problem, but nothing changed, I also checked with notepad ++ if there was not one by checking that my file wp-config.php was not encoded in utf8 with bom, which usually creates accent problems in French.

So I suspect it could come from either the wordpress theme (Sahifa) or the plugin (wp-automatic) that publishes my articles from rss feeds.

Do you have a track that can guide me on the origin of the problem?

Share Improve this question asked Mar 21, 2019 at 11:45 Frenchy_WPFrenchy_WP 191 silver badge6 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

This actually happens to me. I usually resolve this via string replace function. First one replaces the WordPress Content area. The second filter is replacing the Title area.

Check out the str_replace array and insert your œ to your own string before the $content array.

function replace_the_content_filter( $content ) {

    if ( is_single() )
    // Add image to the beginning of each page
    $content = str_replace(array('«','"', '“', '”'), '"', $content);

    // Returns the content.
    return $content;
}
add_filter( 'the_content', 'replace_the_content_filter', 20 );

function replace_the_title_filter( $content ) {

    // Add image to the beginning of each page
    $content = str_replace(array('«','"', '“', '”'), '"', $content);

    // Returns the content.
    return $content;
}
add_filter( 'the_title', 'replace_the_title_filter', 20 );

I hope that helps. Please be careful on the Title or Content section. If you wanna do it on Attachment title then check the https://developer.wordpress/reference/hooks/wp_get_attachment_caption/.

Goodluck.

Simpler still:

 function RemoveTheSlashes( $content ) 
    {
    $FixedContent = stripslashes($content);

     // Returns the content.
     return $FixedContent ;
   }
 add_filter( 'the_content', 'RemoveTheSlashes', 20 );

Will turn this: /' into just the '

本文标签: pluginsProblem of encoding characters (apostrophes) in my posts publications