0

first of all - this is not a duplicate. I searched for any solutions, but found none.

I try to save a text from php to mysql, which looks like this: NETWORK

But in MySQL, it will look like this: NETWORK

I already tried different charsets: big5, utf8 (not very intelligent), ujis, sjis, gb2312

If I print the text in PHP, it'll look right, so the problem is in MySQL. Any ideas for what charset I can use?

  • I think your problem cause by your mysql client doesn't support that charset, the string wasn't common characters. I think it is not problem, it might be problem if you print wrong text in your browser. – Vuong Mar 25 '18 at 11:14
  • You already admit the problem: you don't know what encoding your data is using. How PHP prints code is of little help because PHP strings are not encoding aware. If it's a new project just use UTF-8 everywhere. If it's legacy code/data you'll have to print hexadecimal values and figure out the encoding by yourself. – Álvaro González Mar 25 '18 at 11:58
  • Possible duplicate of [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – Progman Mar 25 '18 at 15:27
  • did you set your db connection to unicode, ie `SET NAMES utf8`? – Ben Mar 26 '18 at 07:05

0 Answers0