WordPress.org

Ready to get started?Download WordPress

Forums

UTF-8 not working for non-database content (7 posts)

  1. cyberfly
    Member
    Posted 7 years ago #

    I set WordPress to use UTF-8 charset and the content from database displays perfectly (not in phpMyAdmin, but it doesn't matter) but all other content stored in *.php files (PageTemplates etc.) doesn't inherit this property and displays bad characters. When I view the site's source, there's only one "charset=UTF-8", not overridden by anything else.. The language I use is czech but UTF-8 shouldn't have any problem with that.
    Website's located at sco.hustej.net

    Thanks for any advice.

  2. yare
    Member
    Posted 7 years ago #

    I'm having the same problem with Croatian language, but only recently since 2.2 ver.

  3. moshu
    Member
    Posted 7 years ago #

    @cyberfly,
    are you sure youare saving those php files after editing with the correct encoding? You MUST use a plain text editor that saves the files with utf-8, otherwise the characters are messed up. Note: eve Notepad on XP has the feature to select the encoding!

  4. bolonki
    Member
    Posted 7 years ago #

    Moshu, I don't think this has anything to do with the encoding when saving files in notepad or whatever, he is referring to the reading options in the control panel, set to UTF8. I am having huge problems with character encoding too, even though both WP and my database are UTF8, I'm stumped.

    My question is, what values should I enter for the database encoding and collation in WordPress 2.2 config.php?

    I thought 2.2 would solve this problem with the special database connection and collation options in config.php, but it has not worked for me -- I wonder what is the right value, if you have the database and wordpress settings to UTF8, with the standard swedish_ci / Latin1 that comes with MySQL?

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    No, moshu is correct.. WordPress doesn't do some kind of magic character set translation. If your PHP files are not saved as UTF-8 text, then they won't come out as UTF-8 text, no matter what your "settings" are.

    If the database content is working okay but the other stuff is not, then I'd look closely at the other stuff. It's not a matter of the settings here.

    My question is, what values should I enter for the database encoding and collation in WordPress 2.2 config.php?

    UTF-8 across the board, of course. However, that's not going to affect anything outside of the database options. If the database is working, but the theme is saved in some other charset, well...

  6. moshu
    Member
    Posted 7 years ago #

  7. Hanniph
    Member
    Posted 7 years ago #

    I was having the exact problem and yet i have found a sollution. Moshu was right: saving my code with UTF8 encoding really helped.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags