Encoding/Collation problem!? WTH

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
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Encoding/Collation problem!? WTH

Post by Sindarin »

I created a blogging system for a client. The system works perfectly on my pc (using xampp) and on my online server (linux/php5/mysql5)

But on the client's server (windows/php4/mysql5) the string,
Το Νερό
becomes,
Το �?ε�?ό
So the rho (ρ)(=lowercase) character and nu (N)(=uppercase) doesn't get recognized when echoed on a webpage. All other characters have no problems. :crazy:

I am using utf8_unicode_ci for the collation using MEDIUMTEXT and I am freaking out. Thank you. :banghead:
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Encoding/Collation problem!? WTH

Post by jaoudestudios »

Are you encoding special characters when they go into the database?
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: Encoding/Collation problem!? WTH

Post by Sindarin »

I use tiny MCE editor, and in the init script,
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
entity_encoding : "raw",
valid_elements : "*[*]",
plugins :...etc.
but the problem is that the title textfield contains Greek characters too but it's not using tiny MCE.
It seems not right that except 2 characters everything else it's okay and also works on 2 other servers I tried plus locally. Could something about their MySQL be corrupt?
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: Encoding/Collation problem!? WTH

Post by Sindarin »

I've found the solution,

It seems the problem I was having is a mysql bug after all (Bug #9091). They had version 3 installed on their server! 8O
The bug is not present on mysql 4.01or later.
It has a solution/hack though. So before I connect to the database I'll have to do this query:

Code: Select all

mysql_query("SET NAMES 'utf8'");
:drunk:
Post Reply