WordPress.org

Ready to get started?Download WordPress

Forums

UTF-8 charset in HTTP headers missing (6 posts)

  1. hugo
    Member
    Posted 10 years ago #

    Not exactly a beta, but I tried the 2004-08-10 nightly just now. And stumbled over something I allways notice with software that want's to serve HTML pages with UTF-8 charset. The pages include a meta tag telling about the charset - but the server still sends out the default charset in the HTTP headers in requests. Many browsers regard - correctly - the HTTP header higher than the meta tag. It would be a very good idea to add header(...) calls to the wp-blog-header and admin-header in WordPress so that all pages are served with the correct HTTP header. Sure, people could change that in the Apache configuration, but usually this isn't done. Setting it explicitely in the pages is much better - and you actually try to do that already with the meta tags.

  2. michelv
    Member
    Posted 10 years ago #

    You can't send a charset alone, it needs an accompanying mime-type.
    If we wanted to send a charset, we would have to pick a mime-type for pages, and sooner or later someone will blog "OMG WP serves XHTML as text/html, it's considered harmful!" or "OMG WP serves XHTML as application/xhtml+xml, Google can't read that!".
    --
    Blame the Apache AddDefaultCharset setting that comes by default in most distros' Apache. The W3C itself filed a bug against that very setting's presence in the default httpd.conf.
    Here's a workaround: "AddDefaultCharset none" in .htaccess.

  3. hugo
    Member
    Posted 10 years ago #

    But WP _does_ send a content type already with the Content-Type meta tag - adding the exact content type and charset you use there wouldn't do any more damage as already is done.
    AddDefaultCharset none can only be set in .htaccess if the appropriate options override is allowed for that server configuration. You can't be sure that this is allways the case. So I think it would be better to add a content-type selection/entry to the preferences to allow HTTP buffs to do what they want and set this to default text/html (as is now the case with the meta tag) and send this out via header(...) call. That way people without the know will get the expected results and pro-users can easily override everything.

  4. sunshine
    Member
    Posted 10 years ago #

    Hmm. This in my .htaccess works fine for me.
    php_value default_charset "utf-8"

  5. benjaman
    Member
    Posted 9 years ago #

    Maybe I had a similar problem. This http://wordpress.org/support/3/12043#post-1 is what happened to me. Podz's tip was fantastic and my Chinese characters are no longer nonsense. I took the advice and put into my .htaccess file:
    AddDefaultCharset utf-8

  6. Matt Mullenweg
    Troublemaker
    Posted 9 years ago #

    This has been fixed in the CVS.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.