Skip to content
Advertisement

MySQL foreign characters after inserting data

I’m using php to insert data from inputs into MySQL database. The problem is, it shows up in phpmyadmin as foreign characters. I’ve already set my database to utf8_hungarian_ci as you can see here: https://i.gyazo.com/aeca91e44e8f1808bad09584d8e938d7.png

I’m using utf 8 charset in my form:

JavaScript

and I’m also using mysqli_set_charset in my sql connector:

JavaScript

but I still get this result on my page with characters like ő, ú, ű, á, etc. https://gyazo.com/ab3d40574f0c2162aa6b529651e413b3

Edit: I’m also using this header on my index page:

JavaScript

Advertisement

Answer

I had to set the charset at the end just before closing the connection.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement