Skip to:
Content
Pages
Categories
Search
Top
Bottom

Wrong Charset, cannot specify UTF-8

  • @amenadiel

    Member

    I’m running bbpress integrated with WP on a spanish website.

    While the blog itself (http://www.tecnosquad.com/) is succesfully loaded with UTF-8 encoding, the forum (http://www.tecnosquad.com/foro/) loads as ISO-8859-1.

    When looking at the meta headers, I can see that both the blog and forum have this line:

    <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />

    And I can’t understand why the blog success where the forum fails. Any ideas?

Viewing 13 replies - 1 through 13 (of 13 total)
  • @chrishajer

    Participant

    Is it possible it has something to do with the DOCTYPE?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    in the site, where the charset is correct, and

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    in the forum where it’s not correct. I think the DOCTYPE declaration affects the character set. See here:

    http://www.w3.org/TR/xhtml1/#C_9

    I’m not sure if you can change the DOCTYPE on the forum without creating other problems (it’s not the right solution since the forum validates as XHTML 1.1, not transitional), but maybe there’s something at the w3c site that makes sense to you.

    Good luck

    (p.s. this is just a wild guess.)

    @amenadiel

    Member

    Nice guess chrishajer, it gave me a blink of hope but I tried changing the doctype with no results.

    thanks anyway.

    @chrishajer

    Participant

    What browser are you using that gives you this problem?

    @amenadiel

    Member

    It happens in FF 2, IE7 and Opera 9, haven’t tried another.

    @chrishajer

    Participant

    Sorry I don’t have any better info for you. Never dealt with UTF-8 encoding before. How about this?

    http://www.w3.org/International/questions/qa-htaccess-charset

    And, it appears the charset is independent of the browser (from the command line):

    me:~ > curl -I http://www.tecnosquad.com/foro/

    HTTP/1.1 200 OK

    Date: Fri, 26 Jan 2007 17:03:01 GMT

    Server: Apache/2.0.52 (CentOS)

    X-Powered-By: PHP/4.3.9

    Connection: close

    Content-Type: text/html; charset=ISO-8859-1

    me:~ > curl -I http://www.tecnosquad.com/

    HTTP/1.1 200 OK

    Date: Fri, 26 Jan 2007 17:03:10 GMT

    Server: Apache/2.0.52 (CentOS)

    X-Powered-By: PHP/4.3.9

    X-Pingback: http://www.tecnosquad.com/xmlrpc.php

    Connection: close

    Content-Type: text/html; charset=UTF-8

    Now I’m intrigued.

    @chrishajer

    Participant

    Can you put this before the DOCTYPE in the forum header:

    <?xml version="1.0" encoding="utf-8"?>

    Since it’s xhtml, not xhtml transitional like the blog, maybe that will do the trick?

    edit: on my server this resulted in a parse error, maybe because the <? is being interpreted as php? This might not be a good idea :D

    @chrishajer

    Participant

    @sambauers

    Participant

    This is more likely to be a problem with your database setup – make sure your tables are correctly collated/encoded as well as the database as a whole, to some form of utf8.

    I notice that here, the word “Contraseña” which is in the templates/language file is working fine, but part of the title (from the database) “pequeño” is showing up as “pequeño”.

    The thing about using specific encodings, like UTF-8 is that your whole stack has to support it. From the operating system the server is running to the font being used on the clients browser.

    Now as I understand it, you will need to jump through some hoops to fix this. I think it involves converting all yout char/varchar columns in the database to binary and all your text columns to blobs before converting your tables/database to utf-8 collation/encoding. Then after the conversion is done, you change the tables back to what they were. I think there is a full how-to at the mysql documentation website.

    Good luck – backup your database before doing anything, you may want to take your site offline while doing it too.

    @chrishajer

    Participant

    Sam, thanks for giving us a different direction. I forgot all about the database collation. This post in particular, and the thread too, had some good information about this:

    https://bbpress.org/forums/topic/90?replies=19#post-407

    @amenadiel

    Member

    well I don’t think it’s a collation problem. The tecnosquad blog whose charset it’s UTF-8, it’s collated in latin1.

    @amenadiel

    Member

    Solved. I made an .htaccess with this line only:

    AddDefaultCharset utf-8

    and that was it. *grin*

    @mdawaffe

    Member

    WordPress sends Content-Type headers. I guess bbPress should too.

    https://trac.bbpress.org/ticket/561

    @chrishajer

    Participant

    Thank you mdawaffe :)

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Skip to toolbar