Setting php Charset in .htaccess

I have my charset set in .htaccess, so that way my pages will validate as XHTML without having to declare in every header on every page.

I used to use:
AddType ‘text/html; charset=ISO-8859-1’ html

However, I tried to add php to that list, and it did not work.

So I did some more research and found this alternative:
AddDefaultCharset ISO-8859-1

However, I found someone’s post in a forum which said they contacted their hosting provider and got the following response, “We use the CGI version of PHP and some .htaccess changes won’t affect PHP files due to the order of processing.”

Is that probably what’s happening in my situation as well?
If so is there anything I can do? (Other than putting the charset into the header on every page.)

I’m sorry I don’t really know the answers to your questions, but I suspect that you are correct about the PHP-CGI .htaccess limitations being in play.

I’ve got to point out, though, that “putting the charset into the header on every page” seems to be a “real good idea” to insure portability in any case. :wink:

Have you considered just doing that with a PHP include (which would make it easy in the future to change the charset of all pages at once while still having the header appear in the actual page)?


Ah, yes I could do that. I just learned PHP this weekend, so I’m still getting used to it.

I was still in the mindframe of HTML.

Thanks a bunch.

Will, Chemistry Grad Student, DC