$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>plugins - Problem of encoding characters (apostrophes) in my posts publications|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

plugins - Problem of encoding characters (apostrophes) in my posts publications

matteradmin13PV0评论

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 '

Post a comment

comment list (0)

  1. No comments so far