0

I have a TEXT column in my SQL database that contains a £ char in it. I retrieve this column via an sql query and echo it as such:

echo "<div id=\"styler\">$textNote</div>";

But this £ sign appears as � on the page. The rest of the text appears normally.

If I manually input a £ sign on the page like this:

<p>£</p> 

it appears normally.

How can I solve this?

Juicy
  • 11,840
  • 35
  • 123
  • 212
  • 2
    The easiest answer is to replace `£` with `£`. Before it goes into the DB. The more difficult answer is to make sure your input, storage, and output encodings are all playing nicely. – Sammitch Sep 06 '13 at 21:24
  • Have you read this? http://stackoverflow.com/questions/11816330/php-sql-utf-8-encoding – Sergiu Paraschiv Sep 06 '13 at 21:25
  • make sure database have uft8_encoding and html has utf too, and if you use htmlspecialchars for encoding to html – dev.meghraj Sep 06 '13 at 21:48

1 Answers1

0

Try with this:

<?php header("Content-type: text/html; charset=utf-8"); ?>
Black Sheep
  • 6,604
  • 7
  • 30
  • 51