user1985788
user1985788

Reputation: 39

Special characters not showing on the web page after set to charset=UTF8

I have an app that developed with JS, PHP and for some reason it is not able to display the Spanish Accents in the dropdown box which the values are from the mysql table. For the same app, it display those Spanish accents without any problem on the windows web server IIS 8.5, but not in the Linux box which running REL 6.5 with apache 2.2 installed.

Here are what I did try and checked.

The charset=UTF-8 already set in the meta header in the html. The php.ini on both servers are set default to UTF-8

Default charset for Apache config file is set to UTF-8.

Checked the locale setting on Linux box to make sure include the es-UTF8 in the sysconfig.

Checked the chrome dev tool by inspect the response header and the content-type showing plain/html , charset=UTF-8, vary: accept encoding.

If I go into the phpMyAdmin and look at the raw table, the accents are stored in the MySQL table and I can search it too inside phpMyAdmin.

Upvotes: 0

Views: 1546

Answers (1)

Samir Selia
Samir Selia

Reputation: 7065

Run below query before executing actual query:

mysqli_query($con, 'SET names UTF8');

Upvotes: 1

Related Questions