note 71662 deleted from function.header by tularis

From: Date: Fri, 20 Apr 2007 14:17:10 +0000
Subject: note 71662 deleted from function.header by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-125630@lists.php.net to get a copy of this message
Note Submitter: david at webdawn dot com ---- We're building an application that parses the URL and responds according to the structure contained there (similar to the way WordPress does it). The problem we ran into was that in spite of having the correct charset (ISO-8859-1) in the database and set in the HTML meta tags, the browser was still rendering the pages in UTF-8 encoding (which seems to be the default on the server). Using AddCharset in .htaccess didn't work, since that only applies to certain file extensions and was useless given our "domain.com/directory/directory/" URL style (that is, no file extensions appear in the URL, so the charset in .htaccess seems to be ignored). After searching high and low on the Web for a solution, the only thing we found that worked was using the following to force the Content-Type for displaying the pages our application generates: <?php header('Content-Type: text/html; charset=ISO-8859-1'); ?> This is sent to the browser before any content is output. Now all the accents on the page display correctly and the proper charset information is sent to the browser. Hopefully this will save someone else some head-scratching! If anyone knows of a better way to handle this issue (we've tried everything we came across so far), please let me know.

« previous php.notes (#125630) next »