Does anyone know how can I default web browser character encoding in php, which I hope all user drop in to the page with using character encoding western (ISO-8859-1)
3 Answers
Instead of writing this header header('Content-Type: text/html; charset=ISO-8859-1'); in each of your web applications you could add this simple line in your .htaccess file
It makes Apache to serve out always the charset header.
Otherwise you could set once for all the php.ini directive default_charset to "iso-8859-1". On most web hosters is usually set to empty string.
In order to do this once for all you need either to access the server main php.ini file or get an hoster with suPHP that will allow you to use your specific php.ini file in the same way you use .htaccess files. (suPHP is used by almost every webhosters).