0

I have imported data from excel sheet to mysql and phpmyadmin is showing data in correct encoding or you can say in a readable form like

51cm (20¼”)
41cm (16¼”)

However when i try to display this data in my application it is displaying it as

51cm (6½â)

i think there is problem with " this symbol....

How can I fix this.. I have already tried using

htmlspecialchars_decode()

html_entity_decode()

but no solution so far.. Any help will be deeply appreciated. Thanks ...

Gaurav Mehra
  • 471
  • 7
  • 20
  • 3
    Have you set the mysql connection mode to UTF-8 and also set PHP headers (or html content-type) to UTF-8? – Paul Aug 31 '13 at 09:56
  • its already in the header and also mysql connection mode is already UTF-8 – Gaurav Mehra Aug 31 '13 at 10:06
  • `header('Content-Type', "text/html; charset=utf-8")` in front is more important than ``. Check in your browser the encoding, the page is probable not in UTF-8, as `½â` is very typical. – Joop Eggen Aug 31 '13 at 11:37

4 Answers4

3

It appears that your script is converting text that is already in UTF-8 from ISO-8859-1 (or less likely, Windows-1252) to UTF-8.

Look for something like a utf8_encode() call that shouldn't be there.

PleaseStand
  • 31,641
  • 6
  • 68
  • 95
1

For special charters encoding you have to do below possible solutions :

1) Add meta tag in header <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

2) Use html_entity_decode($data_value, ENT_QUOTES, "UTF-8")

0

Try this,

html_entity_decode($data_value, ENT_QUOTES, "UTF-8")
Manish Chauhan
  • 595
  • 2
  • 7
  • 14
0

please try this if it works `

htmlentities($data_value);`
Ahmad Gulzar
  • 355
  • 2
  • 8
  • 23