26 Aug, 2014

Set internal encoding to UTF-8 for php

Use the following code in your script to set the internal php encoding to UTF-8:

Also, for mysql and postgres you should take into consideration the following two commands:

SET character_set_results = ‘utf8’, character_set_client = ‘utf8’, character_set_connection = ‘utf8’, character_set_database = ‘utf8’, character_set_server = ‘utf8’

update pg_database set encoding = pg_char_to_encoding(‘UTF8’) where datname = ‘thedb’