ââ¬â¢
is being displayed instead of -
in php page
I tried using different encoding types like:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
and
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
but result is the same. What could be the problem?
Input
<strong style="color:#A8A8A8;">1</strong>
â Lorem Ipsum.
Result
1 ââ¬â Lorem Ipsum.
If your database contains ’ , then it's your database that's messed up. Most probably the tables aren't configured to use UTF-8 . Instead, they use the database's default encoding, which varies depending on the configuration.
Getting weird characters like  instead of or ’? Most likely there is a Character set problem. It can occur when a MySQL and PHP are upgraded or when data has been incorrectly stored or the application is sending an incorrect (or missing) character set to the browser.
The reason lies in the UTF-8 representation. Characters below or equal to 127 ( 0x7F ) are represented with 1 byte only, and this is equivalent to the ASCII value.
Mojibake (Japanese: 文字化け; IPA: [mod͡ʑibake]) is the garbled text that is the result of text being decoded using an unintended character encoding. The result is a systematic replacement of symbols with completely unrelated ones, often from a different writing system.
Make sure your html header specifies utf8
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
That usually does the trick for me (obviously if the content IS utf8).
You don't need to convert to html entities if you set the content-type.
check http://php.net/manual/en/function.mb-convert-encoding.php
<?php
header('Content-Type: text/html; charset=utf-8');
mb_internal_encoding('utf-8');
?>
may be this will help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With