Reputation: 13926
while working on templates weird problem occured:
when templates are being rendered (i guess), in code, right before the doctype, strange character is being placed. I call it "strange" because if I select it, copy it and try to paste nothing is pasted. This "dot" is seen only if I do "view source" in webkit browsers.
now, layout breaks.
while checking rendered code in internet explorer web developer toolbar, I've seen that also doctype is pasted within body tag, so I have an impression that both, opening and closing, head tags are somehow being ignored. (i've checked it now and yes, If I take out opening and closing head tags from my template, that is exactly what happens).
this is rendered code in ie web developer toolbar: http://i48.tinypic.com/noby81.gif
please help!
Upvotes: 1
Views: 586
Reputation: 31
The easiest way to resolve problems with BOM in templates is to change FILE_CHARSET in your settings.py to 'utf-8-sig'
Upvotes: 3
Reputation: 1
I think that answer is easy. Open all of your files (html) envolved on extends or includes with the vim editor. Probably you will see in the first line some strange characters. Remove this and your problem is resolved. I don't know what the reason for this but it resolve the problem.
Upvotes: 0
Reputation: 799580
Perhaps what you're seeing is the Byte Order Mark, or its byte-reversed counterpart, the Zero Width No-Break Space. Some text editors place it at the beginning of text files in order to help detect the encoding of the file. You can use a tool such as od to see the exact byte sequence.
Upvotes: 5