• Resolved TomJohnson

    (@tomjohnson)


    I have strange characters, like this —, in a lot of my posts. I am used to typing alt+0151 to make an em dash (—), but I recently had to restore my site, and it involved copying and pasting the database from WordPad. Maybe that’s where it got messed up. Anyway, how do I get rid of the — symbols and replace them with dashes? I have lots of posts to fix if I have to do it manually. My site is at http://idratherbewriting.com

    By the way, I do have the encoding tag set in my header.

Viewing 8 replies - 1 through 8 (of 8 total)
  • This is a problem with incorrect encoding… WordPad is not the best choice when restoring databases 🙁

    Better use Dreamweaver, which supports various encodings, and copy -> paste from it. Or any other editor, which supports UTF-8, and many other encodings… I can’t say if there’s a way to automatically fix the wrong characters in the database.. If you keep the original MySQL backups/files, better open them with the correct editor and make the copy paste again:)

    Thread Starter TomJohnson

    (@tomjohnson)

    Thanks lelion. I blogged about my adventures with this issue here. WordPress 2.2 backup and restore adventure

    Excellent choice – using Notepad. I’d recommend even that over Dreamweaver. (But there’s better text editors out there – sometimes even Notepad can mess things up.)

    Nice post! 🙂 Glad you fixed things up! 🙂

    (You may want to mark the thread as [resolved] now;-)

    Thread Starter TomJohnson

    (@tomjohnson)

    Just a clarification to doodledee’s comment for other readers. I’m using Notepad++, which is significantly different from the Notepad installed by default on Windows computers.

    I just did a delete and then total clean install of version 2.2 and got all those ascii replacements throughout most posts which used many different kinds of punctuation.
    It did not matter what theme. I upgraded another blog a few hours earlier and no problems. However…

    This time I had USED THE BRAND-NEW CONFIG.PHP FILE (first new one I’ve ever seen and I almost didn’t look at it).

    As soon as I read this thread, I READ THIS LINE ABOVE:

    Or any other editor, which supports UTF-8,

    and remembered seeing that line on the New config.php file.

    I deleted the new and put back in the old and everything was perfect again. This is the first ever problem I’ve had with a WordPress install (script-wise) in about 40 installs and upgrades since May 2004.

    Whahoppened??

    Resolved

    <?php
    // ** MySQL settings ** //
    define(‘WP_CACHE’, true); //Added by WP-Cache Manager
    define(‘DB_NAME’, ‘account_name’); // The name of the database
    define(‘DB_USER’, ‘account_user’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘secretword’); // …and password
    define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value
    define(‘DB_CHARSET’, ‘utf8’);
    define(‘DB_COLLATE’, ”);

    // You can have multiple installations in one database if you give each a unique prefix
    $table_prefix = ‘wp_’; // Only numbers, letters, and underscores please!

    // Change this to localize WordPress. A corresponding MO file for the
    // chosen language must be installed to wp-content/languages.
    // For example, install de.mo to wp-content/languages and set WPLANG to ‘de’
    // to enable German language support.
    define (‘WPLANG’, ”);

    /* That’s all, stop editing! Happy blogging. */

    define(‘ABSPATH’, dirname(__FILE__).’/’);
    require_once(ABSPATH.’wp-settings.php’);
    ?>

    The new settings in the wp-config.php file (SET NAMES and COLLATION) are for those who had used an old trick in wp-db.php to make WordPress “talk” with the MySQL database in UTF-8, in case the server default is different (latin-1, for example).

    If you had a blog and everything worked OK in it, then you DO NOT need to add ‘SET NAMES’ and ‘COLLATION’ in the wp-config.php file! You need to do this only if you used a modified wp-db.php file and want to stop ‘hacking’ this file in order to make the encoding/collation OK for the database:) Now you simply add this to the wp-config.php – and life is easier for us:)

    I had the exact same problem as described by the initiator of this thread after I upgraded to the latest version of WP. Protechs’ advice to change back to my old wp-config.php is exactly what was needed to get rid of all the strange symbols and restore my text. Thanks so much, Protech, for your simple and effective advice!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Strange Characters — —’ is closed to new replies.