1

MySQL version 4.1 and its collation utf8_general_ci doesn't seem to like specific Cyrillic characters - 'с' and 'я'. Works in MySQL versions 5.0 and above.

Since the field is being used to store information in languages other than Russian (English, Estonian, German), changing the type of collation is unthinkable.

Has anyone had issues relating to that? Any thoughts (except upgrading MySQL)?

Thanks!

Mati
  • 1,378
  • 15
  • 20
  • 1
    What do you mean by "not like" exactly? – Pekka Oct 15 '11 at 19:12
  • Try `mysql_query(mysql_query('SET character_set_results=utf8');` when you run your queries. I've heard of this problem before, but I can't remember what the exact solution was. – Watermark Studios Oct 15 '11 at 19:16
  • Characters above are shown as '�?'. – Mati Oct 15 '11 at 19:17
  • 3
    This needs much more info for a decent answer. What are you doing exactly? Where is the data coming from, how is it entering the database? What platform or language are you using to get the data? How are you connecting to mySQL? What does the code look like? Where are you outputting the characters? What platform are you on? Can you show some code? – Pekka Oct 15 '11 at 19:18
  • I'll try to describe the problem in detail then. On my webpage I have form that saves data into database. Now, when I retrieve those entries from database and try to show them on webpage, characters mentioned above are shown as '�?'. Webpage has encoding utf8, table and the field both have collation utf8_general_ci. – Mati Oct 15 '11 at 19:22
  • 1
    I had a quick answer, but it was based on PHP/MySQL stack. Pekka made a good point that we don't even know if you are using PHP. Please refer to Pekka's comment and provide further detail. – Watermark Studios Oct 15 '11 at 19:29
  • *How* does your webpage save data into the database? Using what programming language and what database library? (Edit: @Watermark beat me to the punch.) – Pekka Oct 15 '11 at 19:29
  • Im using PHP, data is received with POST request and written into db with command mysql_query(). I dont think it has anything to do with PHP at all, because all the other characters are rendered correctly. – Mati Oct 15 '11 at 19:41
  • @WatermarkStudios "SET NAMES = 'utf8';" or "SET character_set_results=utf8;" causes all other characters being displayed faulty too. – Mati Oct 15 '11 at 19:43
  • What is the character set in your HTML header? It sounds like what you are writing to the DB isn't UTF8. ``? – Watermark Studios Oct 15 '11 at 19:47
  • Its UTF8. I'll give you an example: string "оборудование предприятий" is rendered (after being saved and then retrieved) as "оборудование предпри�?тий". – Mati Oct 15 '11 at 19:51
  • 1
    http://www.shawnolson.net/a/946/unicode_data_with_php_5_and_mysql_41.html – Watermark Studios Oct 15 '11 at 19:57
  • Glad to hear it! I just changed the answer to reflect the correct link. Happy coding! – Watermark Studios Oct 15 '11 at 20:16

1 Answers1

0

http://www.shawnolson.net/a/946/unicode_data_with_php_5_and_mysql_41.html

Watermark Studios
  • 1,173
  • 1
  • 10
  • 24