Character sets in PHP

Problem:

How to Set different character sets with PHP and HTML to display correctly.

Solution:

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 your php.ini file in this directory:
    /public_html/php.ini
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: 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"
  • 28 Users Found This Useful
Was this answer helpful?

Related Articles

Configuring the PHP Environment With php.ini

Problem: How do I change the PHP environment for my site with php.ini? Solution:   To...

PHP with FastCGI

Problem: What is FastCGI for PHP? Solution: FastCGI for PHP makes all your PHP applications...

Upload_Max_Filesize

Problem: How do I change my upload_max_filesize? Solution: Summary Locate the php.ini...

Cron Jobs with PHP Files

How do I run a php file using Cron jobs?   From the cPanel, click the Cron Jobs icon and enter...

Basic Site Security Checklist

Remove malicious files and/or files you are not familiar with. While many PHP applications...