Welcome Guest ( Log In | Register )




                Web Hosting

 
Reply to this topicNew Topic
Unicode Encoded Site - Characters Not Displaying Properly?
miCRoSCoPiC^eaRt...
post Feb 22 2007, 05:20 PM
Post #1


PsYcheDeLiC dR3aMeR
Group Icon

Group: Admin
Posts: 2,242
Joined: 29-January 05
From: Nakorn Chaisri, Thailand
Member No.: 2,411
myCENTs:84.36


Hey guys,
I've been working on a AJAX based CMS for a client for the last few days and am in the final stages of deployment. I've run into a slight problem here. The site is supposed to be in Norwegian. The back-end uses the tinyMCE editor for adding in content, which is stored in MySQL. Now this presents no problem at all and the content is displayed just fine in the browser..

Problem arises when it comes to the site menu. It is a drop-down menu script from DynamicDrive, which reads off the menu items the same way from MySQL as the content and builds up the menus dynamically.. this is where it's messing up. The Norwegian characters in the menus are not being displayed properly.. in most cases, you can see that ugly "?" which turn up when your browser / page-encoding doesn't cover the displayed character set.

Now it can't be a problem with MySQL coz all these fields are declare utf8_general_ci. Also when I send in the page headers, I made sure to send in..

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

.. so that the page encoding is set right.

What baffles me is WHY the content should appear fine and NOT the menu items !! You can take a look at the demo site here: http://gaute.chaos-laboratory.com

Any ideas how to fix this?

Cheers,
m^e




Go to the top of the page
 
+Quote Post
pyost
post Feb 22 2007, 08:19 PM
Post #2


Nenad Bozidarevic
Group Icon

Group: [MODERATOR]
Posts: 1,053
Joined: 7-November 05
From: Belgrade, Serbia
Member No.: 9,500
myCENTs:36.94


If it's the same thing I had to deal with a few months ago, then it is a MySQL issue (but not a problem). You can read more about this here.

Anyway, one of the solutions to this problem is to run this query every time you open a MySQL connection:
CODE
SET NAMES 'utf8'


Ugh.. Actually.. If the content appears OK, but the rest doesn't.. wacko.gif I might be wrong, but do give it a shot.
Go to the top of the page
 
+Quote Post
mastercomputers
post Feb 23 2007, 02:26 PM
Post #3


PESTICIDAL MANIAC
Group Icon

Group: Members
Posts: 630
Joined: 1-September 04
From: Auckland, New Zealand
Member No.: 27


Well changing the encoding to Western ISO shows it correct, which suggests that's the encoding being used for the menu. Maybe part of the site, grabs ISO encoded data, that needs to be converted to Unicode, or you need to make sure each page, including external scripts be UTF-8 encoded when saved. Most editors should be capable of doing that, if not, then I don't think you should use those editors.

Javascript works on UTF-16, so it's output should be fine, it could screw up with it's content it grabs though.

I can't really dive too much into all this, I'm tired as anything, just got home, so hopefully you can sort it.

Cheers,

MC
Go to the top of the page
 
+Quote Post
miCRoSCoPiC^eaRt...
post Feb 26 2007, 08:10 AM
Post #4


PsYcheDeLiC dR3aMeR
Group Icon

Group: Admin
Posts: 2,242
Joined: 29-January 05
From: Nakorn Chaisri, Thailand
Member No.: 2,411
myCENTs:84.36


Was away for a coupla days.. just came back

Let me work on the ideas you guys have suggested and see if I can spot the problem..

Regards,
m^e
Go to the top of the page
 
+Quote Post
vhortex
post Feb 26 2007, 03:56 PM
Post #5


Guilty Until Proven Innocent
Group Icon

Group: Members
Posts: 372
Joined: 13-April 05
Member No.: 3,937


QUOTE(miCRoSCoPiC^eaRthLinG @ Feb 23 2007, 01:20 AM) [snapback]98322[/snapback]
Hey guys,

Problem arises when it comes to the site menu. It is a drop-down menu script from DynamicDrive, which reads off the menu items the same way from MySQL as the content and builds up the menus dynamically.. this is where it's messing up. The Norwegian characters in the menus are not being displayed properly.. in most cases, you can see that ugly "?" which turn up when your browser / page-encoding doesn't cover the displayed character set.

Cheers,
m^e



m^e!

are those menus being pulled from the database by using an ajax call? if they do you need to tell ajax to return the data in utf8 or utf16 format, i go with utf8.. it seems that the encoding of the menu was western ISO as given by the post above this.

i use to have that problem too then i explicitly told ajax to parse the data as utf8 since i am storing them as utf8_general_ci... in cases i forget to tell the ajax script about the encoding, i get the swedish charset which is the default on my server and my special chars turn into chunks of ?..

did you check the colation also in the mySQL database that the columns that holds the menu data are indeed set to utf8, i made this mistakes and mySQL uses the default charset.

Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts 18 torres1287 1,887 5th January 2009 - 06:09 PM
Last post by: iG-brennan
No New Posts   0 zainboy 55 25th December 2008 - 08:48 PM
Last post by: zainboy
No New Posts 10 PUNKANGEL 8,587 24th December 2008 - 11:33 AM
Last post by: kpxchunsa
No new   22 Marcella 2,498 24th December 2008 - 03:54 AM
Last post by: chifro
No New Posts   4 laniczech 267 12th December 2008 - 02:06 AM
Last post by: quack
No New Posts   2 TavoxPeru 268 10th December 2008 - 12:21 AM
Last post by: Sellaman
No New Posts 16 JasPuneet 845 10th December 2008 - 12:09 AM
Last post by: Sellaman
No New Posts 11 BHerath 1,357 6th December 2008 - 09:47 AM
Last post by: TehJohn
No New Posts 4 psionics 271 4th December 2008 - 11:36 PM
Last post by: Quatrux
No new   39 mastercomputers 10,222 4th December 2008 - 01:39 AM
Last post by: laniczech
No New Posts   5 honmore 1,678 1st December 2008 - 12:37 PM
Last post by: iG-Greg Chumney
No New Posts   14 Casanova 2,227 24th November 2008 - 02:31 PM
Last post by: TheUnreal
No New Posts   14 J.C. 6,695 10th November 2008 - 10:41 AM
Last post by: yordan
No New Posts   6 3d4ya 363 28th October 2008 - 02:03 AM
Last post by: Gamers HQ
No New Posts   10 jjkeenan 552 27th October 2008 - 12:24 PM
Last post by: yordan