Retrieving Special Characters From MySQL Database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
michaeln31
Forum Newbie
Posts: 3
Joined: Wed Jan 12, 2011 6:47 pm

Retrieving Special Characters From MySQL Database

Post by michaeln31 »

Hey,

I've been trying to retrieve certain characters from my mySQL database, characters such as 'ç' and 'á'. I use these characters in certain words, such as 'Français' in a menu for my site. The menu works fine on my localhost, all characters are displayed properly, however when I upload my site and database to my server, 'ç', for example, becomes '�' or '?'. Seeing as it works on my localhost I'm guessing that it is a setting issue with my server's database or I've just coded my menu to suit my localhost only.

Any ideas?

Mike
thecodewall
Forum Commoner
Posts: 33
Joined: Sun Dec 26, 2010 8:37 am

Re: Retrieving Special Characters From MySQL Database

Post by thecodewall »

Check your database setting I think its different compare to your localhost database.
michaeln31
Forum Newbie
Posts: 3
Joined: Wed Jan 12, 2011 6:47 pm

Re: Retrieving Special Characters From MySQL Database

Post by michaeln31 »

The only settings I can think of are MySQL charset and MySQL connection collation. I've tried changing the collation but with no effect, I cannot figure out how to change the charset. Could this be where the problem lies? The charset on the server is set to UTF-8 Unicode (utf8), which i thought should work ok, I've set my localhost to the same as my server and it seems to work fine. Are there other settings I should be looking at?


Thanks again,

Mike
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Retrieving Special Characters From MySQL Database

Post by VladSun »

Try calling once

Code: Select all

SET NAMES utf8
after DB is selcted.
There are 10 types of people in this world, those who understand binary and those who don't
michaeln31
Forum Newbie
Posts: 3
Joined: Wed Jan 12, 2011 6:47 pm

Re: Retrieving Special Characters From MySQL Database

Post by michaeln31 »

Nope, had no effect. What's confusing me is that when i set my localhost similar to my server it works fine. Is there another reason this would be happening?


Mike
Post Reply