Vbulletin character encoding problems

Look at http://otakuhelpers.com/#news_2 under “entertainment news”. I have a problem with certain characters and Japanese characters showing up like:
“& #8220;”/“& #8217;”/ect… (no white space) are unconverted. Vbulletin causes the page to be sent as ISO-8859-1 when the page is not cached as it’s imported,

How do I make vb send pages UTF-8?

What charset/character encoding is vBulletin currently set to use when interacting with it’s database?

How do I check that? I think it’s latin1_swedish_ci ?

<meta http-equiv=“Content-Type” content=“text/html; charset=ISO-8859-1” /> is what it sends to the browser.

I viewed your site using Firefox 24.

The Firefox Web Developer Inspector shows your Content-Type header is screwed up. You are sending:

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

Should be:

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

Secondly, your HTML entities are screwed up. Your HTML source shows:


The entity number should begin with an ampersand (& character) not an entity name (& ).

Are you running htmlspecialchars() or [URL=“http://php.net/manual/en/function.htmlentities.php”]htmlentities() on the ampersand character when you should not be? Your PHP could be taking the & character in the HTML entity ID and converting it into the entity name &.

Thanks for pointing out the


I had a line to convert & to that in the core of my script to make the page validate and didn’t notice it did that.

1 problem fixed!

However I don’t know how to fix the character encoding issue. I think it’s the way I include the vbulletin global.php file when the page is not cached, but I’m not sure.

header('content-type: text/html; charset: utf-8');
ini_set('default_charset', 'utf-8');

is at the top of the global.php file of my script (included at the start of every page)

<FilesMatch "\\.(htm|html|css|js|php)$">
   AddDefaultCharset UTF-8
   DefaultLanguage en-US

is in my .htaccess

First off, this line:

header('content-type: text/html; charset: utf-8');

Appears to me to be wrong. An equal sign should be used, not a colon.


Is that your code above? I don’t see how vBulletin would get that wrong. For now, get rid of the UTF-8 line in your htaccess file. Comment out the line by placing a # sign before the line. Then debug from there. My guess is that vBulletin is sending a UTF-8 header meaning you don’t have to. Once you get this bug fixed then you can uncomment the line in htaccess and see if everything still works and continue using it if there is no bad effect. Right now you need to simplify to narrow down the problem.

That is my code, not vbulletins. I changed the colon to an equal sign and commented out the code in the .htaccess. I think it works now, but I’m not sure. I know it works sometimes when the page is cached, but it does not work correctly when vbulletin is loaded (every 30 seconds depending on if you are the first user or not).

I have to modify something in vbulletin to make it stop doing that to the page when vbulletin is loaded.