0

I have data in MySQL such as "регистрацией в партнерской" but when it comes out in PHP echo'ed out it comes out as ????. My issue here is that I believe I have tried the obvious (see list below), so what else could I be missing?

  1. SET NAMEs is UTF8 in Mysql
  2. There is a header
  3. I have tried with/without utf8_encode / utf8_decode
  4. I've tried mb_convert_encoding
  5. My table (Innodb) charset is utf8 with utf8_general_ci

If this is a direct duplicate please show me but I think I've hopefully covered the initial checks I should have!

Thamilhan
  • 13,040
  • 5
  • 37
  • 59
Ukuser32
  • 2,147
  • 2
  • 22
  • 32
  • Look for the html code for them, or use the PHP [htmlspecialchars](http://php.net/manual/en/function.htmlspecialchars.php) function – Can O' Spam Nov 12 '15 at 11:03
  • You tried a few things, whatever that actually means, but apparently you did not succeed to make your whole tool chain utf compliant. At least one component still assumes iso encoding. – arkascha Nov 12 '15 at 11:03
  • @SamSwift No, that is not a solution. You cannot implement international sites by converting each and every character. These are not html relevant characters, but normal utf characters. – arkascha Nov 12 '15 at 11:03
  • Are you echoing the database values directly or are you using any kind of string manipulation on those values before output? – maxhb Nov 12 '15 at 11:03
  • `` or `Content-Type: text/html; charset=ISO-8859-1`? – Thamilhan Nov 12 '15 at 11:04
  • 1
    I'm pretty sure that whatever it is, will already be answered here : http://stackoverflow.com/questions/279170/utf-8-all-the-way-through/279279 – CD001 Nov 12 '15 at 11:05
  • @SamSwift I actually converted from a word document which did that. I purposefully have changed it :) – Ukuser32 Nov 12 '15 at 11:06
  • Cheers guys I am checking out the URL now ! – Ukuser32 Nov 12 '15 at 11:06
  • @maxhb I have tried both - doing a string manipuilation with utf8_en/decode but not actually any string functions such as replace and I've also just tried outputting the mysql data straight – Ukuser32 Nov 12 '15 at 11:08
  • Not sure it is?? Anyway the link makes no mention of SET NAMES which I've been advised is the correct way and what is the difference with utf8mb? – Ukuser32 Nov 12 '15 at 11:10
  • *SET NAMES* essentially does the same as `$mysqli->set_charset()` ... unless you're using PDO, then you'd (normally) pass the charset in the DSN. – CD001 Nov 12 '15 at 11:15
  • @maxhb - my mistake at one point I did do string manipulation but also did try without! – Ukuser32 Nov 12 '15 at 11:16
  • Well thanks guys for all your comments and I hope this helps for anyone finding it - the solution therefore was to change the db types to utf8mb4, remove utf8_encode function and $this->db->query("SET NAMES 'utf8mb4'");. I didn't need to use charset on the dsn. – Ukuser32 Nov 12 '15 at 11:22

0 Answers0