Page 1 of 1

Encoding/Collation problem!? WTH

Posted: Mon Oct 20, 2008 9:01 am
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:

Re: Encoding/Collation problem!? WTH

Posted: Mon Oct 20, 2008 11:01 am
by jaoudestudios
Are you encoding special characters when they go into the database?

Re: Encoding/Collation problem!? WTH

Posted: Tue Oct 21, 2008 2:41 am
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?

Re: Encoding/Collation problem!? WTH

Posted: Wed Oct 22, 2008 3:15 am
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: