WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WP2 accented characters changing (16 posts)

  1. escdotdot
    Member
    Posted 8 years ago #

    I upgraded to WP2 over the holidays and have since had problems with accented characters in posts.

    I use ecto on Mac OS X to post to my blog (http://www.escdotdot.com/blog/). I created a post using ecto with ö (o + umlaut): http://www.escdotdot.com/blog/2006/01/07/o/ . It uploads correctly, and views correctly when you visit the site.

    However if I then have ecto refresh it's list of posts, it tells me that "The content for the entry "ö" (138) on the server is different from the one that is stored locally. Are you sure you want to overwrite the local copy?". If I agree then the accented character changes to this new set of two characters (although the website still shows the correct character).

    The post is shown correctly in the WP admin, so I don't understand why ecto thinks it has changed? If I write the same character in a post using the WP admin, the same thing happens - ecto downloads a post with these changed character.

    Is there any way I can things to sync correctly?

  2. editor
    Member
    Posted 8 years ago #

    I'm getting the same problem in importing my database in my localhost with Xampp, and I had a serious problem of accented characters in moving my site to another (excellent) hosting provider. I solved that problem with a copy and paste of my posts from another site of mine.I know, not a very technically-skilled operation, but I had no other choice...I think that developers at WP should focus on this character encoding issue because, also checking at this forum threads, it appears there's no definitive solution.

  3. escdotdot
    Member
    Posted 8 years ago #

    Thanks for your reply, editor.

    If, in phpMyAdmin, I go into the post that I mentioned (http://www.escdotdot.com/blog/2006/01/07/o/) then the phpMyAdmin screen shows the content as "ö" even though it's displayed as ö on the web page. So would I be right in thinking that mySQL is serving the posts with the wrong character encoding?

    I've had a dig around in phpMyAdmin but do not completely understand how it works, so may be misunderstanding what it's telling me, but the localhost screen says that:

    MySQL charset: UTF-8 Unicode (utf8)
    MySQL connection collation: utf8_general_ci

    However, when I go into my databases' structure table, the collation for every table is 'latin1_swedish_ci'.

    Could this be where the problem lies (i.e. the mismatch between utf8 and latin1), and if so, what should I do about it?

  4. escdotdot
    Member
    Posted 8 years ago #

    well, I have a solution to my prob. Apparently it's a bug with mySQL 4.1

    This post on another forum gave me the answer.

    All I had to do was add the line:
    mysql_query("SET NAMES 'utf8'");
    to the file /wp-includes/wp-db.php right after line 43 (where it makes the database connection).

    This fixes posting and retrieving posts with accented characters. But I now have to go back through my posts and retype many of the accented characters (and some quote marks) as they seem to have permanently changed into different characters.

  5. moshu
    Member
    Posted 8 years ago #

    Hey, that's a great help!
    A lot of people have been struggling with this when moving DB around.
    Actually even the move of this forum resulted in exactly the same kind of errors - I can show you a lot if interested :)
    I guess we should include this info in the backup/restore guide for those that use accented characters.

  6. editor
    Member
    Posted 8 years ago #

    Very useful! I strongly hope this is the definitive solution to all the trouble related to character encoding!

  7. stratoman
    Member
    Posted 8 years ago #

    Hello,

    if i insert the line after 43 i receive this error message:

    Parse error: parse error, unexpected T_STRING in /home/www/web540/html/wp/wp-includes/wp-db.php on line 44

    something is wrong.
    pls help
    greetings ralf

  8. escdotdot
    Member
    Posted 8 years ago #

    stratoman,
    two thoughts - perhaps your wp-db.php has been changed such that it's not line 43 that is where the extra line needs to go? In my set up, the new line goes immediately after this one:

    $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);

    Or, doing a quick search on "unexpected T_STRING" returns results that suggest there is an extra parenthesis/quote mark/white space somewhere in the line.

  9. stratoman
    Member
    Posted 8 years ago #

    @escodot
    now there is no error, cause the " were wrong, but the problem is still the same.
    but the funny is. the headline diplays correct, only the text is wrong?
    any further ideas? look at http://www.ralf-schwanke.de
    thx 4 hlp

  10. escdotdot
    Member
    Posted 8 years ago #

    Hi stratoman, I can't read German so I can't tell where the problem is in the texts - but there don't seem to be any characters that aren't displaying correctly. Perhaps you could flag where the problems are in some way?

    Most of your meta tags in the header are all unclosed, by the way.

    And I don't know if this is an issue or not but the character set for the page is set (in one of the meta tags) as ISO-8859-1 rather than UTF-8 (which is what MySQL is delivering the data as) - you'll need to do some research on how/if this will affect the display of the characters - I'm just guessing with this point.

    Hope that helps!

  11. BobWalsh
    Member
    Posted 8 years ago #

    My wordpress blog has suddenly developed the same issue of all posts being littered with "???" instead of single quotes etc. AND the fix in this thread has been made with no visible effect.
    Help!

  12. Chris_K
    Member
    Posted 8 years ago #

    BobWalsh - have a link we could use to see this in action? What happened before this "suddenly" started happening?

  13. BobWalsh
    Member
    Posted 8 years ago #

    http://mymicroisv.com - see the first line in the second post. That's just it - I can't connect the start of this with any one (adding a plugging, reactivating a plugin) event. The actual data in the database has been changed!

  14. moshu
    Member
    Posted 8 years ago #

    Bob, keep it in one thread and answer there the questions more precisely if you want help :)
    http://wordpress.org/support/topic/76633?replies=10

  15. durruti
    Member
    Posted 7 years ago #

    When someone makes a trackback or pingback, it appears on my blog like this:

    [...]This is the excerpt from the trackbacking blog[...]

    Which is fine, but when I tried to validate any pages with the [...] bit using the W3C validator, I got a validation failure apparently due to unrecognisable non-UTF8 characters. Changing the validator's encoding option from automatic to ISO-8859-1 allowed me to validate the page (which it did perfectly) and check the source code. [...] appears in the source code as […], and it was this that seemed to be the cause of the problem when trying to validate using the UTF-8 option. As far as I know it's valid UTF-8 encoding so I couldn't figure out why it was causing a failure.

    escdotdot, adding your single line of code has sorted it out completely. The source code still reads exactly the same but the W3C validator now automatically recognises it as UTF-8 and validates it - no more unrecognisable characters. I have no idea why it works but it does, so thanks for sharing the info.

  16. Baskineli
    Member
    Posted 7 years ago #

    As escodot said, adding mysql_query("SET NAMES 'utf8'");
    to the file /wp-includes/wp-db.php right after line 43, helped me and fixed my site.

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.