Welcome Guest ( Log In | Register )



 
Reply to this topicStart new 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



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,013
Joined: 7-November 05
From: Belgrade, Serbia
Member No.: 9,500



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: 626
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



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) *
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 topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Special Characters In Notepad(13)
  2. Good Places To Advertise Your Site(20)
  3. Flash Site Software(12)
  4. Www.modthesims2.com - Sims 2 Mods Site(8)
  5. Create A Site Without Cms But Just Dreamweaver?(6)
  6. Add A Forum To Your Site(23)
  7. What Is Unicode System(1)
  8. Please Hack My Site(23)
  9. Help, My Laptop Charger Is Not Working Properly(17)
  10. PHP & MySQL: Displaying Content From A Given ID(6)
  11. What Is The Best Photo Sharing Site?(16)
  12. How To Create Your Own Proxy Site (free And Easy)(13)
  13. Love Calculator(1)
  14. Youtube Videos(4)
  15. Does This Site Mean Anything To Us…i Don’t Know U Tell Me?(4)
  1. My Site Got Hacked!(10)
  2. Site Down Again, Help Or Suggestions?(6)
  3. Time Travel?(1)
  4. Main Trap17 Site Is Down?(0)
  5. Request Form Site Suspended(4)
  6. Free Site(5)
  7. Characters Customization(0)
  8. A Site I Put Together Over The Last 3 Days(5)
  9. Help Me Host My Site On My Pc(4)
  10. Nice Models And Free Models, New Site!(4)
  11. Free Fast Web Submission(0)
  12. Need To Copy An Entire Site..(7)
  13. Site Language(8)


 



- Lo-Fi Version Time is now: 11th October 2008 - 03:02 PM