WordPress.org

Ready to get started?Download WordPress

Forums

Strange WP behavior: Correct Czech in browser - incorrect in database (19 posts)

  1. peerSr
    Member
    Posted 8 years ago #

    Could you help me please?

    I have installed here http://codex.wordpress.org/WordPress_in_Your_Language recommended WordPress 2.0.2 cz from http://www.dgx.cz/trine/item/cesky-wordpress-ke-stazeni

    At first sight everything is working like a charm - Czech mutation with UTF-8 encoding.

    Problem is as declared above: Czech characters are correct in IE or FF, but incorrect in database.

    Instead of:
    http://www.jakpsatweb.cz/images/kodovani/isoasiso.gif
    what can be seen in explorer, Czech characters in database look like this:
    http://www.jakpsatweb.cz/images/kodovani/unicodeaswin.gif

    I know - I should seek for help on Czech forums. Which I already did - without success.

    I suppose it hase to do with PHP 5.1.2.

    I did a try with my-hacks.php:

    mysql_query('SET character_set_results=UTF8');
    mysql_query('SET character_set_connection=UTF8');
    mysql_query('SET character_set_client=UTF8');

    or

    @mysql_query ("SET NAMES utf8");

    But this didn't work neither.

    Thanks in advance (and sorry for my English)

    pe

  2. peerSr
    Member
    Posted 8 years ago #

    just one more note: Unicode is displayed in database like windows-1250 ..

  3. moshu
    Member
    Posted 8 years ago #

    To be honest, I don't understand why do you care what is in the database? And no, utf-8 characters do NOT look the same in the database as they are displayed. That's normal.

    The only important question is: do they display correctly in your browser? Do they display correctly in any browser? If yes, then don't worry about things that are not important :)

  4. peerSr
    Member
    Posted 8 years ago #

    problem is when trying to restore wp from db backup - with Czech characters.
    At least I had problems.

  5. moshu
    Member
    Posted 8 years ago #

    That might happen because the encoding in one database is different than in the other, because of the wrong encoding settings in the database, because of different versions of MySQL...

  6. peerSr
    Member
    Posted 8 years ago #

    OK - thanks for the answer.
    On both hostings (former and new)they have PHP 5.
    And MySQL 4.1.14 - 15

    My DB and tables collation was in both cases UTF-8.
    Anyway - I have to try it again.

    Important for me is the thing you wrote about UTF-8 (I didnt know that UTF-8 characters do not look the same in DB as they are diplayed). Thank you again.

  7. lhk
    Member
    Posted 8 years ago #

    If you want to check whether or not correct unicode is stored in a database, Notepad++ can be extremely helpful. With this you can c/p any database content into the pad and display it as Unicode. If it displays correctly, the database has the correct content. It's OSS:

    http://notepad-plus.sourceforge.net/

  8. peerSr
    Member
    Posted 8 years ago #

    thanks - I did a try - it doesn't display correctly in Notpad++ ..

  9. lhk
    Member
    Posted 8 years ago #

    Did you use code/display as UTF-8 in the tab "formatting"?

  10. peerSr
    Member
    Posted 8 years ago #

    yes I did

  11. lhk
    Member
    Posted 8 years ago #

    Very curious. And it displays correctly in the blog itself? Usually faulty UTF-8 doesn't.

    What does the header say as encoding?

  12. peerSr
    Member
    Posted 8 years ago #

    yes- with code/display as UTF-8 Czech characters in Notepad++ are different, but not correct-

    and yes - in blog itself it displays correctly - strange

  13. peerSr
    Member
    Posted 8 years ago #

    now - I did a fresh install - everything is correct - DB collation UTF-8 - with identical results

  14. peerSr
    Member
    Posted 8 years ago #

    header?

    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

  15. lhk
    Member
    Posted 8 years ago #

    Just in which way are the chars in the DB "faulty"?

    Can you paste a couple in here, your DB version and the correct display version?

  16. peerSr
    Member
    Posted 8 years ago #

    These are Czech characters (I hate them these days):

    ěščřžýáíéĚŠČŘŽÝ­ÁÍÉŇĎĽŤ

    this is how they are in DB:

    ěščřžýáíéĚŠČŘŽÝÁÍÉŇĎĽŤ

    MySQL: Client API version 4.1.13

    collation: utf8_general_ci

  17. lhk
    Member
    Posted 8 years ago #

    That is perfectly normal database content. They display just peachy in my notepad++ as Czech chars.

    That's what I get when switching to "show as UTF-8":

    ěščřžýáíéĚŠČŘŽÝÁÍÉŇĎĽŤ

  18. peerSr
    Member
    Posted 8 years ago #

    yes? great! thanks - but strange it doesnt work on my computer with notepad - why?

  19. nexxton
    Member
    Posted 8 years ago #

    moshu wrote:
    To be honest, I don't understand why do you care what is in the database? And no, utf-8 characters do NOT look the same in the database as they are displayed. That's normal.

    I think that it is not normal!!! I installed another CMS - Drupal, and there is no problem with encoding.
    Russian characters in Drupal are correct in browser and in database.
    But WordPress has serious problem with data in database, data in russian is unreadable.
    Please, fix this bug.

Topic Closed

This topic has been closed to new replies.

About this Topic