Page 1 of 1

Problems with special characters

Posted: Thu Sep 20, 2007 11:12 am
by olavt
I have some strange problems with characters like æ, ø and å, characters we use in Norwegian.

When I use CMSMS "out of the box", there are no problems. But I am using an external database, or rather other tables in the same database as CMSMS and these data are accessed via user defined tags. This tags may be like this:

"$categories = @mysql_query('SELECT * FROM zwpot_categories WHERE cat_ID>2  ORDER BY cat_name');

while ($row = mysql_fetch_array($categories)) {
  echo ''. $row['cat_name'] .'
';}"

What this tag should do is to extract headlines from articles stored in the WordPress tables and display them in CMSMS.

The result can be seen in http://www.torvund.net/index.php?page=test&catid=3

In words extracted from the database, these characters are subsituted with �.

If I just make a simple tag like "echo 'a,ø,å,Æ,Ø,Å'; they display correctly, as they do if I use them on a page in CMSMS. And in the database these characters are stored as they are and should be.

They also display correctly when viewed in WordPress.

The line "Klassisk musikk �ker p� nett" from http://www.torvund.net/index.php?page=test&catid=3 is the headline from http://blogg.torvund.net/2007/09/20/kla ... r-pa-nett/ selected from the same field in the database.

Does anyone have any idea where the problem is?

Re: Problems with special characters

Posted: Thu Sep 20, 2007 11:36 am
by faglork
Hi,

I had a similar problem. I think this is caused by the database data being encoded in ISO-xxxx rather than UTF8.

So I used HTMLENTITIES to convert the data to UTF8:
$text = htmlentities($text, ENT_QUOTES, UTF-8);
Maybe this will work in your case as well.

HTH,
Alex

Re: Problems with special characters

Posted: Thu Sep 20, 2007 12:20 pm
by olavt
The database says that the characterset is UTF-8 Unicode (utf8), so I do not think that this is the problem.