0

I have developped a php website in wamp on Windows 7 64bit. Then i have hosted it on 00webhost. The problem is that in my dev environment all characters with accents work properly but in production it shows like that égé. Also in my dev environment text appears like égé in database but in the production it appears like éè To handle this i have various solutions like executing "SET NAMES utf8" after opening a connexion to the database, setting mb_internal_encoding to utf8, and others. But none work. I am not a php guru so can you explain why this difference and how to overcome this.

M-Jeff
  • 23
  • 1
  • 1
  • 4
  • 2
    I have previously written [**an answer about UTF-8 encoding**](https://stackoverflow.com/a/31899827/4535200) that contains a little checklist, that will cover *most* of the charset issues in a PHP/MySQL application. There's also a more in-depth topic, [UTF-8 All the Way Through](https://stackoverflow.com/q/279170/4535200). Most likely, you'll find a solution in either one or both of these topics. – Qirel Aug 25 '17 at 18:35
  • i have done all of that. one fact is that i have uploaded it i a previous server and it works correctly. see http://mboatek.cf and http://mboatek.com it is the same code. – M-Jeff Aug 25 '17 at 20:34
  • Keep in mind that the data already in the database will not be automatically converted. That will still be broken. If the data in the database is correctly encoded, then there's a step you missed somewhere. All it takes is one step, and it breaks ;-) – Qirel Aug 25 '17 at 20:46
  • data are the same. i have look directly to the database. do you confirm differences in the 2 websites? – M-Jeff Aug 25 '17 at 20:51
  • No, I haven't looked - because it'll most likely not help anways, as the code (PHP) isn't readable by the client anyways. If you are 100% sure the data in the database is correctly encoded, then you haven't followed all the steps (set UTF8 in the MySQL connection, file, headers in PHP and HTML, database-columns, etc). – Qirel Aug 25 '17 at 20:55
  • See "Mojibake" in http://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James Aug 26 '17 at 21:40

0 Answers0