bbPress

Simple, Fast, Elegant

bbPress support forums » Troubleshooting

Wrong Charset, cannot specify UTF-8

(14 posts)
  • Started 1 year ago by amenadiel
  • Latest reply from chrishajer
  • This topic is not a support question
  1. 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?

    Posted 1 year ago #
  2. 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.)

    Posted 1 year ago #
  3. Nice guess chrishajer, it gave me a blink of hope but I tried changing the doctype with no results.

    thanks anyway.

    Posted 1 year ago #
  4. What browser are you using that gives you this problem?

    Posted 1 year ago #
  5. It happens in FF 2, IE7 and Opera 9, haven't tried another.

    Posted 1 year ago #
  6. 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.

    Posted 1 year ago #
  7. 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

    Posted 1 year ago #
  8. This document is also very good:

    http://www.w3.org/International/tutorials/tutorial-char-enc/

    Posted 1 year ago #
  9. 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.

    Posted 1 year ago #
  10. 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:

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

    Posted 1 year ago #
  11. well I don't think it's a collation problem. The tecnosquad blog whose charset it's UTF-8, it's collated in latin1.

    Posted 1 year ago #
  12. Solved. I made an .htaccess with this line only:

    AddDefaultCharset utf-8

    and that was it. *grin*

    Posted 1 year ago #
  13. WordPress sends Content-Type headers. I guess bbPress should too.

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

    Posted 1 year ago #
  14. Thank you mdawaffe :)

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.