Jump to content

HTML: HTML Character Encoding in Page or at Server Level?


justravis

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.