WordPress.org

Ready to get started?Download WordPress

Forums

Encoding problem and MySQL (4 posts)

  1. Miklos
    Member
    Posted 8 years ago #

    When trying to move a WordPress blog from one machine (mine) to another (a provider) by dumping the local tables with PhpMyAdmin and loading them with the remote PhpMyAdmin, I noticed a corruption of all unicode caracters (the blog is in French). Looking at the contents of both MySQL bases (the wp_posts table, eg), I noticed they were encoded differently, and while they display correctly in WP on the source machine, it's not the case on the destination.

    Both WP installations are configured with UTF-8 encoding.

    I also notice something weird on the local (OK) blog; a character like â (a circumflex) which, in unicode, is <E2>, and should thus be in UTF-8 <C3><A2> (unless I am wrong), is represented in the MySQL table as <C3><83><C2><A2>, which baffles me no end (and probably PhpMyAdmin too). I don't know what this encoding is, why it is not UTF-8 and then why it shows correctly in the blog...

    Help would be appreciated. Thanks in advance,

    M.

  2. _erik_
    Member
    Posted 8 years ago #

    you know that you can switch between different charsets in phpmyadmin? eg when i look at field-contents of a post in phpmyadmin using iso-8859 it seems like there were weird signs and characters within the database. if i switch to the correct utf-8 "view" in phpmyadmin everything looks fine.
    so if the blog on your providers webspace shows strange characters, you should check the response header of the server, as this setting can "override" your encoding and charset options given in the admin-interface and thus in the themes meta-tag.
    (you can watch the servers response header by using the web-developer-extension for firefox or http://www.web-sniffer.net for example) The Server defines the Charset in the AddDefaultCharset directive (you can also check this with a file thats content is: "<?php phpinfo(); ?> and call it in the browser)
    Solution: If you dont have root-access edit the .htaccess in your root-directory and add a line
    AddDefaultCharset utf-8
    at least this fixed the problem i had with my webspace...
    more info see here:
    http://padawan.info/web/debugging_charset_encoding_mismatch_with_apache.html

  3. Miklos
    Member
    Posted 8 years ago #

    Thanks. It does not change anything locally: the encodings in the local MySQL database are definitely odd to my eye (4 characters or more for "simple" special characters) but it works locally; i.e., WP knows what they are. However, they are not UTF-8.

    I have been able to find that it may have something to do with the remote PhpMyAdmin, when trying to import data which I dumped locally: characters such as "é" (e acute), which are coded in 4 characters, import correctly, but the French apostrophe (which has a longer encoding) does not.

    I am totally lost, now. I wouldn't like to go through 200 articles and fix them by hand...

  4. _erik_
    Member
    Posted 8 years ago #

    who would like to do that? sorry i'm having no other idea...

Topic Closed

This topic has been closed to new replies.

About this Topic