search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

BOM at beginning of body

Asked by Andrew Brisbin
6 years ago.

How do I hide the  characters above the calendar? When I save the file as UTF-8 without BOM, then the calendar height doesn't render correctly (the height doesn't render the full height of the browser and instead renders at 300px). Saving as UTF-8 with BOM results in the  characters showing above the calendar, but the calendar height is correct.

No other changes were made in the creation of the 2 screenshots included.

Answer posted by Dan Letecky [DayPilot]
6 years ago.

It looks like without the BOM the browser doesn't recognize the <doctype> section at the top of the HTML file and renders the document in quirks mode.

There might be a problem with some non-ascii character before the doctype (that might not be visible in a regular text editor - try a hex editor).

If that's not the case, check the server configuration - try adding the Content-Type HTTP header with UTF-8 specified (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type). You can also try adding <meta charset="UTF-8"> to the HTML document.

Comment posted by Andrew Brisbin
6 years ago.

I tested in Chrome and when I removed the BOM from the file and check the mode, I am not in quirks mode (document.compatMode = CSS1Compat).

Our webserver already adds a content-type header with UTF-8 specified and <meta charset="UTF-8"> was also in the HTML head. The calendar still renders with a height of 300px.

I am still working on trying to view a non-ascii character before the doctype.

Do you have any other ideas on why without the BOM it is rendering differently?

Comment posted by Dan Letecky [DayPilot]
6 years ago.

It still looks like the file (I assume it's the HTML page we are talking about) is corrupted in some way. Especially if this is the only page that has the problem.

I'd probably start with an empty file and try to copy the content back piece-by-piece until the problem reappears.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.