I am having problem in displaying the
in my web page, after using utf8_decode() in PHP it gets displayed as �.
i have been using
When you use utf8_decode
, the string that is passed to this function where is it loaded from? Are you loading data from database? Do you have any included files? If so, check that they are all encoded as GmonC wrote. Try to echo
somewhere in page and see if it will show correctly. If not, try to make clean .php file and than see if problem still occurs. If not than some included file could be the problem because it could have different encoding
Also make sure you give the document a proper dtd definition by putting something like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
As the first line of html in your php file.
Be sure that you've specified UTF-8 encoding in your HTML document's tag:
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
That's strange since utf8_encode(' ')===' '
. Regardless of whether it's utf8 or latin1 encoded the byte-sequence for
is the same.
Is the remaining string properly utf8 encoded?
edit: Why do you use utf8_decode() (converting utf8 encoded strings to latin1) in the first place when you're telling the browser that your page is utf8 encoded?
Have you checked the encoding of the php file itself?
In some windows editors (like notepad++) you can have some utf-8 character problems when you check the wrong encoding for your file - even if you set your meta tag correctly.
In notepad++ you can change it in this section:
Change notepad++ file encoding http://img198.imageshack.us/img198/9081/notepadp.png
If you're not using notepad++, we'll need some more detailed information from your setup, like Operating System used, IDE, etc.