Strange characters not being converted

Look at under “entertainment news”. I have a problem with certain characters showing up like:

do you know how to convert this to the proper character? I tried iconv, but it does not seem to do the trick.

Hi Nination. Welcome to the forums. :slight_smile:

Even though your page specifies the UTF-8 charset, the server is sending the pages as ISO-8859-1. That setting overrides anything on the page. So it would be worth changing your server setup to serve the pages as UTF-8.

I see, thanks for the reply. I’m on shared hosting however. Is there a php function or .htaccess string to modify this? I have no idea why it would be doing that.

If you could, please list both, but I would prefer an ,htaccess modification as I have the same problem on my vbulletin forums.

This is not my area, but I’ll suggest what I’ve learned in the past about this.

Via .htaccess

You could ass this to your htaccess file (reference):

AddDefaultCharset utf-8

or perhaps this (source):

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


You can place this at the top of your pages (reference):

header('Content-Type: text/html; charset=utf-8');

Hope that helps. :slight_smile:

In .htaccess I added:

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

In php I added:

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

Some characters work for me now, it’s better than before, but I’m not sure if it works for all users and “& #8220;”/“& #8217;”/ect… (no white space) is still unconverted.

Does it work for you? How did you check to see what the server was sending? Is there something in cpanel to modify this?

P.S. I love sitepoint.

Huh, as first it seemed to be be working for me, but when I refreshed, it was back to the previous state. Did you revert back, or is that code still in there?

Is it sending UTF-8 to the browser yet? How do you check that?

Each browser has a different way to check it. In Chrome, I open the developer tools, then choose Network, then refresh the page. Then click on the documents option, then click on a site page like the home page and click on the Headers tab on the right. Under Response Headers you’ll see the charset being sent from the server.

Hmm…all of the code is still there. I did not modify it since my last post.

The page seems to be UTF-8
However, the main page is using “Windows-1252” on Firefox and “ISO-8859-1” on chrome. I’m baffled. lol

I’m seeing it all as UTF-8 in Chrome and Firefox now. Perhaps do a few page refreshes and check again.

The problem was my vbulletin forum sends the wrong character encoding when the page is not cache. Do you know how to make vbulletin send the right encoding and how to fix those other characters converting?

I’m afraid I don’t, but I’m sure many around here do. If they don’t see this thread, perhaps post a vbulletin-specific question in the CMS forum.

I made a new thread here: