views:

293

answers:

3

Hi, found a interesting problem during testing our web application.

I have application on localhost (Windows) and online testing server (Linux). Both are connected to same DB (on Linux server). When I tried to edit one text field through form in application located on Linux server it crop diacritics from result and save it to DB without it. But when I tried the same action, with the same code on locahost (Windows) it save whole text with diacritics right as I wrote it.

I've tried to check PHP configuration, but I have exact same configuration on both machines.

Does anybody have an idea where should I have to look to find what problem should cause that ?

A: 

Do both servers serve the page in the same encoding?

In firefox, visit the page, right click and 'View page info'. There'll be an entry for Encoding. For these to transfer correctly you'll need UTF-8 or similar encoding.

After that, check your database setup. You'll need to set the MySQL connection to use UTF8, and your tables and columns should be set to utf8 as well.

You can set the mysql connection character set by issuing the following query after connecting:

SET NAMES 'utf8'
David Caunt
Everything is in UTF-8, I've looked in POST data and there is also diacritics. I think problem is somewhere in Zend application.
beny
+1  A: 

Sounds like one or more of the character settings on the MySql instance on your Windows machine is not set to UTF8, try executing this query:

show variables like '%character%'

Your output will be the character_encoding related server variables, executing that on my database outputs:

character_set_client        utf8
character_set_connection    utf8
character_set_database    utf8
character_set_filesystem    binary
character_set_results      utf8
character_set_server        utf8
character_set_system        utf8
character_sets_dir        /usr/share/mysql/charsets/

My best guess is that one or more of those is set to latin1

Also, you might want to check the collation, i.e. execute this

show variables like '%collation%'

And you will get something like:

collation_connection    utf8_general_ci
collation_database    utf8_general_ci
collation_server        utf8_general_ci
karim79
A: 

Found a problem of using one filter ont that field which acts differently on different system.

beny