Charset conflicts

Found an issue with the phpBB system here at NESdev? Use this forum to report problems.

Moderator: Moderators

User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Charset conflicts

Post by Quietust »

Whenever I attempt to fetch a document from the forum, Apache is specifying the character set to be ISO-8859-1, causing Mozilla and Firefox to IGNORE the charset defined in the document's <meta http-equiv...> tag. As a result, ALL forum languages are being displayed as ISO-8859-1 rather than the character sets they specify.
If I recall correctly, the problem is within PHP's configuration - it has a way to specify a default character set, whicih must be DISABLED in order for this to work properly.


[EDIT]
An alternate fix for this problem is as follows:
1. Open includes/page_header.php
2. At the end, locate the line `$template->pparse('overall_header');`
3. Before that line, insert `header ('Content-Type: text/html; charset=' . $lang['ENCODING']);`
4. Open admin/page_header.php
5. At the end, locate `$template->pparse('header');`
6. Before, insert `header ('Content-Type: text/html; charset=' . $lang['ENCODING']);`
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Guest

Post by Guest »

It's early in the morning, so pardon me if I'm off my rocker. *still rubbing his eyes*

I don't think this kind-of change is possible; PHP is run as a CGI, not an Apache module.

Meaning, there's no way (I know of) to set default_charset to "" (to disable PHP sending the HTTP Charset: header, as mentioned here) outside of using "php_value" or "php_admin_value" inside of Apache via .htaccess or the httpd.conf.

I would think using ini_set() inside of PHP would come too late in the process (default HTTP headers already being sent at that point), but I really don't know just how much of a "pre"-parser PHP is, if you get my drift. Otherwise, I'd probably just use ini_set() inside of phpBB's extension.inc.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Charset conflicts

Post by koitsu »

Quietust wrote: An alternate fix for this problem is as follows:
1. Open includes/page_header.php
2. At the end, locate the line `$template->pparse('overall_header');`
3. Before that line, insert `header ('Content-Type: text/html; charset=' . $lang['ENCODING']);`
4. Open admin/page_header.php
5. At the end, locate `$template->pparse('header');`
6. Before, insert `header ('Content-Type: text/html; charset=' . $lang['ENCODING']);`
I've deployed this -- so far it looks legit.

There sure seems to be an awful lot of oversights in this forum software...
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Charset conflicts

Post by Quietust »

koitsu wrote:I've deployed this -- so far it looks legit.
And it looks good here, too. Firefox is finally displaying the Japanese language pack in UTF-8 like it's supposed to.
There sure seems to be an awful lot of oversights in this forum software...
The phpBB team actually knows about this problem already; they simply decided to defer fixing it until phpBB 2.2 (which is still pretty far from release).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Guest

Re: Charset conflicts

Post by Guest »

Good deal. Also solved the Email issue, and tinkered with some of the style colours a bit... I'm really going to need tepples or someone else to go through those and figure out what looks good for the boards.

Of course, this is also just a "test run" -- if the back-end db gets horked or we break something in the process, it's not a big deal. Entirely different if and when the board gets moved or migrated... :)

Wiki stuff is coming along well (blargg dropped me an Email), I see!
Guest

Post by Guest »

That reply should've been from me, koitsu. Damn login things... ;D
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust »

Er, it looks like this problem has reappeared...
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Guest

Post by Guest »

Sounds like my upgrade of MySQL 4.0.8 to 4.0.11 somehow "broke" the default table settings. I'll fix it after I take care of some stuff first.

Pretty weird that it'd break though. Very odd...

-- koitsu
Guest

Post by Guest »

That should be 4.1.8 to 4.1.11, sorry. God I'm going brain-dead...
Guest

Post by Guest »

Looks like its not related to MySQL this time, but rather the server headers.

I see a lot of the PHP scripts for the board here updated on May 7th (today) about 5 hours ago, so my guess is that memblers upgraded it or something along those lines.

The problem looks like the Content-Type being sent in the HTML is iso-8859-1 regardless of what the actual content is, so I'll have to go fix all of that up... Heh. :-)
Guest

Post by Guest »

Yep, found that some of the language/ files had been changed (particularly lang_english's stuff) back to iso-8859-1. I set it to utf-8. The other languages were not touched (still utf-8).

In addition, the include/ and admin/ php files mentioned in this thread had also been updated and lacked the set-lang-encoding code.

According to my peers, things are working now. View Source shows the right thing, so I believe its working okay.

Let me know. :-)

-- koi
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers »

Yep, I updated phpBB today by uploading the changed files. Sorry if I broke something, heheh. Maybe it's safer to use the patch, but I don't know how.
Guest

Post by Guest »

Memblers wrote:Yep, I updated phpBB today by uploading the changed files. Sorry if I broke something, heheh. Maybe it's safer to use the patch, but I don't know how.
Don't worry about it, man. :-) Q caught it, so it's all good.

Maybe I should write up some stupid little doc thing with some perl+sed crap which will recursively go through and fix all of it after an upgrade. *lazy zzzz*

-- koi
Guest

Thanks

Post by Guest »

Damn, i never thought of looking at it that way, thanks.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust »

It's time to apply this fix again...

Dammit, Memblers, next time use the patch file!
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Post Reply