• dominoeffect

    (@dominoeffect)


    Hi all!

    I’ve moved my entire blog from one domain to another by copying over the files and database. Everything has worked successfully except for some reason special characters are no longer displaying correctly.

    Special characters such as French-style accents now show up as other characters e.g. “?o” instead of “ú”.

    any guidance on what the problem might be and how it can be resolved would be most appreciated, thanks.

    M

Viewing 7 replies - 1 through 7 (of 7 total)
  • stvwlf

    (@stvwlf)

    Hi

    This is a common problem with character encoding when moving sites.

    The simple answer is you have to do replace statements in the database, using MyphpAdmin. The queries would be like this

    UPDATE wp_posts SET post_content = replace(post_content, '?o' 'ú', '');

    1) MAKE A DATABASE BACKUP BEFORE YOU RUN THESE QUERIES

    2) The query above means:
    replace all occurrences of the incorrect character in the post content field with the correct character, and update the database with the changes.

    That one query will update all the posts. You must run the query one time for each incorrect character type. That is, if 6 different characters are displaying incorrectly, you run the query 6 times, each time with a different set of “old” and “new” values.

    replace(post_content, '?o' 'ú', '')
    the word post_content stays the same in every query – that is the table being updated.
    the second parameter is the incorrect value you want to replace
    the 3rd parameter is what you want to replace it with.

    Thread Starter dominoeffect

    (@dominoeffect)

    Hi,

    Do you suppose it would be ok to use SCR to do the same replacement job? (SCR is software referenced here: https://www.tamba2.org.uk/wordpress/move/ )

    Thanks very much for the help.

    stvwlf

    (@stvwlf)

    Hi

    You can’t use SCR for database queries. Its for replacing text in disk files, and the database is not a disk file, per se.

    However, your request reminded me that not long ago I read MichaelH recommending a WP plugin that lets you do this search and replace from within WordPress. This is a much easier way for you to go.
    https://www.ads-software.com/extend/plugins/search-and-replace/
    You can click under plugins in WP admin Add New and search for search-and-replace and install from there.

    After the plugin is installed, its options page is under Settings.
    Check the very first box, Content. Then scroll to the bottom and enter values for Replace and With, and click Go.

    You need to do that one time for each different character that is garbled. This approach takes all the database work out of the process.

    I will try to remember this one in the future.

    Thread Starter dominoeffect

    (@dominoeffect)

    Hi again

    I should have said, I meant using SCR for updating the database offline, then re-uploading it.

    Your way is much easier though, I will update the post with my progress. It’s going to take a while to find every wrong character in 300-odd posts (-:

    Thank you,

    Oh

    You don’t even need SCR for that. Any programmers editor will work as the database file is only a single file.

    As far as 300 posts, I generally find there are only a few characters that get garbled. Once you correct the most obvious 2 or 3 most of the scrambling will be gone. Then you can update as you encounter more scrambled characters, rather than having to look through 300 posts.

    Hi,
    I had the same problem. I fixed it by adding this two lines to my wp-config.php:

    define(‘DB_CHARSET’, ‘utf8’);
    define(‘DB_COLLATE’, ”);

    (Backup first – of course – and try this if you want. I had to manually edit the few posts done after the move)

    I don’t like this solution, nor the replace one. I’m pretty sure there’s something more logical to be done to fix the DB. That’s why I got here ??

    Thread Starter dominoeffect

    (@dominoeffect)

    Sorry for the late reply.

    I ended up using the Search & Replace plugin – I figured it was less of a risk than reuploading the entire database again. Great plugin, thanks for the reccommendation.

    There are actually a surprising number of foreign characters on my blog and some still remain, so I will try out your suggestion Helil.

    Thanks for the help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Moved entire blog now Special Characters won’t display right’ is closed to new replies.