0

In a html page, some space showing �. I am also using

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

in the head, but not working. Here is an example:

Movie: Bombay Velvet
Singer:�Suman Sridhar
Music:�Mikey McCleary
Music Label: Fox Music

I am trying to figure out from yesterday, but couldn't. Please help, what might be causing this issue.

Solved: mysql_query("SET NAMES 'utf8'", $connect);

Thanks to everyone.

Dilip Kumar
  • 63
  • 10

1 Answers1

0

As your data comes from a Database and PHP. You can set connection enconding at startup.

If you are using Mysqli connection driver you can do this:

mysqli_set_charset ( $mysql_connection , 'utf8' );

or in OOP:

$mysql_connection->set_charset('utf8');

Reference: http://php.net/manual/pt_BR/mysqli.set-charset.php

In another drivers you need to see similar function.

  • Sorry not working yet. May be some other problem here. I will go for the link provided by Martin – Dilip Kumar Jun 16 '17 at 14:13
  • Charset problems is very anoing. You need to verify these things: - if your connection to database are responding in correct charset. - if your files are saved in correct enconding (in Atom, this is showed at bottom bar) - if your http request in on correct encoding (this can be changed at runtime using: `header('Content-type: text/html; charset=utf-8');` – Fábio Arantes Jun 16 '17 at 14:19
  • yeah i tried checking it from the server side and yeah it is saved in UTF. And also i tried header in php, not working yet. – Dilip Kumar Jun 16 '17 at 14:38