How to display different languages in php

Posted in php

PHP sometimes doesn’t want to display the characters of a different language. I use Dreamweaver as my text editor and recently I needed to add Chinese characters to a php navigation include. When I tried to add the characters within actual php code – Dreamweaver converted the characters into “????”. It worked fine when it was plain HTML.

Here are some tips:

Within Dreamweaver:
Click on the Modify main menu item and select Page Properties.
Change the Encoding/Document Encoding dropdown to say “Unicode (UTF-8)” or “Unicode 4.0 (UTF-8)”
Click OK
Save the document

Originally for some reason the Dreamweaver file I created was encoded in ANSI, it needed to be switched to UTF-8.

Until I figured out the Dreamweaver setting I had to open the include file in Notepad change to UTF8.

Hope this information is helpful!