How to set up Unicode

Comparing #22 with #23

Revision #23 was created by kafeg kafeg on Feb 20, 2013, 2:57:00 AM.

add example for project convertation

Content

[...]
## 1. PHP script files ##

Make sure that you use an editor which is capable of using UTF-8 and save all your files UTF-8 encoded without [BOM](http://en.wikipedia.org/wiki/Byte_order_mark). If you have some older non-unicode files in your project open them with your editor and save them again UTF-8 encoded. On Linux you can also use command line tools like `recode` or `iconv` to convert a whole bunch of files.

For Example:
 
~~~
 
[bash]
 
$ cd /var/www/myproject/
 
$ sudo su
 
# for i in $(find -name '*.php');do encoding=$(file -bi $i | sed -e 's/.*[ ]charset=//'); iconv -f $encoding -t UTF-8 -o $i $i; done
 
# exit
 
~~~
 

## 2. Database tables ##

You need to set to UTF-8 the encoding of your connection to the SQL server. It's recommended to set up every table in your database needs to use the same charset for its content, but if it's not the case, the SQL server will convert the text on-the-fly. So **this step isn't mandatory, but it's highly recommended**.

The configuration for that might differ between database systems.
[...]