Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

We have a website (www.semanticdesigns.com) that delivers a default encoding of ISO-8859-1. The pages are written in, guess what, ASCII mostly with some ISO-8859-1 characters.

We have a few example directories where the pages under that directory are actually UTF-8-encoded with BOM. (http://www.semanticdesigns.com/Products/Formatters/JavaHTMLJunit/index.html) These display fine in IE8 and IE9, but FireFox gets confused and displays just the BOM characters

 " "

My reading of the HTML standard is that we need to add a meta tag to those pages:

 <meta http-equiv="content-type" content="text/html;charset=UTF-8"></meta>

These pages are generated automatically if it isn't obvious, so this is an easy change to make. But, I tried patching this by hand, but it doesn't seem to have an effect on FireFox.

How does the browser actually decide which encoding to use? The default one provided by the server? Or what's in the meta tag? Suggestions on how to solve this problem, without changing the site default?

share|improve this question
add comment

2 Answers

The charset specified by web server in the HTTP header has priority.

There are a few solutions to your problems:

  • Tell web server to output different header for files in some directories (use AddCharset of AddDefaultCharset directives in the context)
  • Convert all into UTF-8 and use only this charset
  • Convert your UTF-8 encoded pages into iso-8859-1 using HTML entities (I don't know if there is a parameter in JavaDoc allow you to do it)
share|improve this answer
add comment

as far as I know the meta tag ( < meta > ) is totally ignored in firefox

the correct way to specify charset is sending the "Content-type" http-header, not the html meta tag (that anyway should reflect the same value of the http one)

the rule that actually firefox uses to set the display encoding is:

Content-type: text/html; charset=UTF-8

if you are using Apache, try ( http://httpd.apache.org/docs/2.0/mod/core.html#page-header )

AddDefaultCharset UTF-8

if you are using php you can do also,

header("Content-type: text/html;charset=UTF-8");

if you need a better overview about http protocol's headers, you can download https://addons.mozilla.org/it/firefox/addon/live-http-headers/ that is an useful tool that shows all infos contained in http requests and http responses

hope this helps! Feel free to correct my English.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.