justravis Posted December 2, 2008 Share Posted December 2, 2008 What is the best way to declare character encoding - in page or at server level? If at the server level, do I include 'text/html; charset=ISO-8859-1' as an apache handler or mime type? Furthermore, if I attached them to php files, wouldn't it see the code as text instead of rendering the php? Thank You. Quote Link to comment https://forums.phpfreaks.com/topic/135191-html-html-character-encoding-in-page-or-at-server-level/ Share on other sites More sharing options...
haku Posted December 3, 2008 Share Posted December 3, 2008 Use both. It's best to declare it at the server level to let the browser know what is coming, but browsers also expect the meta tag, so you want it in there as well. Declaring it in the header with text/html will not cause the browser to output php to the browser as text. The header is sent by the server, attached to the HTML that the php script has outputted. By this point, there is no php in the content - the php has already been processed. All that is left is the content, which is why you are declaring the content type. Quote Link to comment https://forums.phpfreaks.com/topic/135191-html-html-character-encoding-in-page-or-at-server-level/#findComment-704516 Share on other sites More sharing options...
justravis Posted December 4, 2008 Author Share Posted December 4, 2008 Haku, U always have the answer. Although I'm still fuzzy on 1 point. In addition to putting it on each page, should I make it an apache handler AND mime type? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/135191-html-html-character-encoding-in-page-or-at-server-level/#findComment-706051 Share on other sites More sharing options...
Mchl Posted December 4, 2008 Share Posted December 4, 2008 Use header. Should be enough. Quote Link to comment https://forums.phpfreaks.com/topic/135191-html-html-character-encoding-in-page-or-at-server-level/#findComment-706087 Share on other sites More sharing options...
haku Posted December 5, 2008 Share Posted December 5, 2008 I agree. Quote Link to comment https://forums.phpfreaks.com/topic/135191-html-html-character-encoding-in-page-or-at-server-level/#findComment-706436 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.