Page 1 of 1

Character Encoding

Posted: Fri Aug 25, 2006 4:49 am
by jamiel
Hi all,

Was wondering if it is possible to put together a list of things between PHP, Apache, MySQL and HTML configurations etc. to ensure that if you have say a textarea in your form, to accept all utf-8 characters eg. German Umlaute's , Pound sign's etc. and for the input to go into a MySQL Database using php, and then be retrieved via php and outputted back to the user and provided that their browser is set to UTF-8, for the output to look exactly as they entered it.

To start the list off as an example:

- Make sure the table in MySQL is created with CHARSET=utf-8

I have iconv hacks all over the place to make this happen at the moment, and I believe the reason I have to do this is purely configuration issues or incorrect Meta tags etc.

Any input welcome.

Jamie

Posted: Fri Aug 25, 2006 6:49 am
by Chris Corbyn
- Make sure either (a) Your web server send the content-type with a charset specified after it or (b) You specify this in a meta tag in your page.
- If you're hard-coding umlauts etc into PHP scripts, make sure you save the PHP script as UTF-8 with your text editor

Posted: Fri Aug 25, 2006 5:53 pm
by Weirdan
make sure your db connection is set to use utf. use 'SET NAMES=utf-8'

Posted: Sat Aug 26, 2006 12:03 pm
by Ambush Commander
Well, you can get away with not setting the DB character encoding in older versions of MySQL (4.0, specifically).