Hello,
I recently noticed that if I edit a post and revert to draft certain words display weird characters. I am using the medium editor.
Examples are word like (it’s) is being changed to (itâÂÂs) only words with (’) are being affected.
Kindly see screenshot below.
I just found out its an encoding problem that can occur on old post when database has been migrated,
I tried this code but it did not work
function fix_weird_characters() { global $wpdb; $replacements = array( '“' => '“', 'â€' => '”', '’' => '’', '‘' => '‘', '—' => '–', '–' => '—', '•' => '-', '…' => '…' ); foreach ($replacements as $key => $value) { $query = $wpdb->prepare( "UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)", $key, $value ); $wpdb->query($query); } } add_action('wp_loaded', 'fix_weird_characters');
Hi Tosin,
That’s an encoding issue.Can you create a demo video showing the content and the steps that is causing it.
Thank you
BrajeshHi Tosin,
Thank you.
I have the hunch that using DomDocument parser is causing it.
The problem is MediumEditor(js library) has been abandoned and we are looking for a suitable substitution for future.At the moment, I will recommend keeping it diabled.
Regards
BrajeshThank you Tosin.
We will do when we find a suitable alternative.Regards
Brajesh
You must be logged in to reply to this topic.