PHP

ID #312

How do I get different character sets within my PHP page to display correctly?

Applies to: Grid System

For information about how to change the character encoding for your static HTML pages, please see this page.

There is a character encoding setting inside of your php.ini file. By default, this is set to the standard Latin encoding (ISO-8859). If you would like to encode your page with different characters, like Arabic or Hindi, you will need to change this.

Most character sets will display correctly with UTF-8 encoding. If you're using an Asian character set, you may need to select a different encoding standard; you can find out specific information about which character encoding will display your characters correctly here.

To change the character encoding in your php.ini file, find the following line and input your preferred character encoding. In the example below, UTF-8 is the character set.

default_charset = "UTF-8"

Note that by default, the default_charset option is commented out. Be sure to delete the leading semi-colon so it does not look like this:

;default_charset = "UTF-8"





Last update: 2010-10-05 15:55
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 3.67 (3 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ

Comment of Anonymous:
I have been having problems with the error of headers already sent when I use session_start(). What I had not realized is that php is automatically set to use charset=ISO-8859-1 and somewhere down the line I changed my set up page to UTF-8. As soon as I changed my charset back, no more session_start() errors. Thanks for the information. It helped me solve my problem.

Added at: 2008-03-27 13:54

Comment of AwesomeBob:
I've been getting this error:
PHP Warning: json_encode(): Invalid UTF-8 sequence in argument...

This fixed it, thanks!
Added at: 2011-04-07 14:59