0

I'm using sending data to a web server using POST headers. When the data contains non-alphabetical character (like, for example, "Ą") it gets mangled (the data contains 'Ä„' instead of 'Ą'). I'm using utf8_unicode_ci collation on this table. How can I fix this?

Kuba Orlik
  • 3,360
  • 6
  • 34
  • 49

2 Answers2

1

Check the character encoding on your web server.

If you include what kind of web server it is, someone can tell you how to check the encoding.

matt
  • 1,947
  • 1
  • 19
  • 29
0

You need to use a unicode CHARSET (in addition to collation) on the specific field in the table as well, if the field was created while the table charset was something other than outf8 charset you want to use.

So check your field values for charset and collation. Charset determines the actual storage encoding, not collate. Collation relates to how the data is sorted. So if it is not being stored correctly, the problem is with charset, not collation.

See this link for more info

http://dev.mysql.com/doc/refman/5.0/en/charset-column.html

And here for specs on ALTER TABLE ... CONVERT TO CHARACTER SET syntax if you need to change the charset.

http://dev.mysql.com/doc/refman/5.0/en/alter-table.html

Mike Brant
  • 70,514
  • 10
  • 99
  • 103
  • Can you tell me how do I change the charset for a particular field in PhpMyAdmin? I can only specify custom collation for each field, not a charset – Kuba Orlik Sep 13 '12 at 17:12
  • Thank you for your effort. I already solved the issue by adding "mysql_set_charset('utf8')" in php script – Kuba Orlik Sep 13 '12 at 17:49
  • @groovy354 That will only select the charset which the MySQL client is using. You still need to make sure that the database itself has the proper character sets on the appropriate tables/columns. – Mike Brant Sep 13 '12 at 17:52
  • Is it necessary? The data is stored properly now – Kuba Orlik Sep 14 '12 at 07:46