I hate characters sets and everything related, they make me get headaches!!
I’m now working on an app for using with OpenCart. The database is coded with utf8-bin.
What I want to do with my app in PHP is take data from an XML (encoded in ISO-8859-1) and put it correctly on the DB (encoded in UTF8-BIN)
I tried using $msqli->set_charset(“utf8”); when connecting, utf8_encode with the strings, but nothing, it still shows strange characters.
Thanks in advance
You need to use UTF8 the whole way. You are right about connecting to MySQL with UFT8, but you must also convert the file after reading it, and make sure you have UTF8 specified in the HTML page, in the header with
<meta http-equiv="content-type" content="text/html;charset=utf-8" />, or in the HTTP header. Otherwise you need to convert to whatever charset you use on the page before printing the strings.My advice is to use UTF8 everywhere. Then you’ll avoid a lot of the problems.