【龍】甲辰年戊辰月己未日 / 三月十八日
Thursday April 25, 2024

PHP

To use multibyte support you can use the Multi-Byte_string functions. These are available as an extended module and have to be enabled with the configure script.

The iconv library functions convert strings between various character sets encodings. The supported character sets depend on the iconv() implementation on your system.

The gettext functions implement an NLS (Native Language Support) API which can be used to internationalize your PHP applications.

When you submit forms, they are will be hard-encoded, so the encoding that will be used to submit your forms will be the encoding that is used for your webpage. If people use an other encoding, your browser will still (mis)treat it as the encoding of your webpage.

You can always use htmlrecode to convert your files. Using the command line.

PHP files require their own header to be send first, however if your file contains a Byte Order Mark (BOM) these headers can not be received by the parser and errors will occur. The most common error would be "Warning: Cannot modify header information"
Do ensure that your file is saved without the BOM. You can use Notepad++ to save the file without BOM. To do this, open the file > go to the Encoding menu > select Encode in UTF-8 without BOM. (Don't use Microsoft Notepad to save php files in UTF-8 as it will always add a BOM to the file)

If you work with MySQL and you want to ensure everything is handled in UTF-8 you can add the following command after setting up your connection :
mysql_query ("SET NAMES 'utf8'");


Zilling Chinese encoding conversion tool
PHP.net
My PHP scripts