1

I don't know a lot about character sets like UTF-8, etc. etc. so I'm getting lost in the terminology from other posts.

I've been using a VARCHAR that is on the default collation in phpMyAdmin (utf8_unicode_ci) and I get a lot of ?, for example: ???(???????)??? Anthony

I've tried changing the row to use ASCII (ascii_general_ci) to no avail. I KNOW that I've fixed this before and it worked 100%, I just don't remember how I did it. Anyone have any ideas?

Thanks!

connergdavis
  • 303
  • 4
  • 11
  • 7
    See [UTF-8 all the way through](http://stackoverflow.com/a/279279). – eggyal Nov 19 '12 at 23:24
  • Okay, so I made it so my PHP code is now setting the character set as UTF-8, both in an HTML and PHP header. There are no more question marks, but the text I sampled now looks like this: á´É´ ã€Æ¸Ì´Ð–̴̆Ʒ】 thanks for the suggestion, it's getting closer! – connergdavis Nov 19 '12 at 23:33
  • 1
    Have you set the character set of the database connection? – eggyal Nov 19 '12 at 23:34
  • ........................... header('Content-Type: text/html; charset=utf-8'); ........................... $mysqli->set_charset('utf-8'); – connergdavis Nov 19 '12 at 23:36
  • 1
    In that case, it's possible that the data in MySQL is corrupt. You might be able to fix it, depending on the nature of the corruption. But it might also be easier to just re-insert it? – eggyal Nov 19 '12 at 23:37
  • I can just drop the table and create it again. Before I do, is the correct collation to use for the text fields utf8_unicode_ci? – connergdavis Nov 19 '12 at 23:38
  • 1
    The *collation* only defines how values will be compared with other strings, so isn't really relevant. What you care about is the *encoding* or *character set*, which should be a Unicode type such as `utf8`. However, if you don't explicitly set an encoding but do explicitly set a collation, one will be inferred from that: in your case, `utf8` would be inferred from `utf8_unicode_ci` so that would be fine. – eggyal Nov 19 '12 at 23:42

0 Answers0