#12301: Template adds extra characters when using utf8 file encoding
------------------------------------+---------------------------------------
          Reporter:  anonymous      |         Owner:  nobody
            Status:  reopened       |     Milestone:        
         Component:  Uncategorized  |       Version:  1.1   
        Resolution:                 |      Keywords:        
             Stage:  Unreviewed     |     Has_patch:  0     
        Needs_docs:  0              |   Needs_tests:  0     
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Comment (by kmtracey):

 The first bytes of your header.html file are EF BB BF.  That's the UTF-8
 encoding of the BOM (byte-order mark, see: http://en.wikipedia.org/wiki
 /Byte-order_mark).  A BOM is neither required nor recommended for utf-8
 encoded files.  I'd guess the browsers are not expecting to find a BOM
 mid-stream and the extra line you see is a reaction to encountering this
 unexpected character.  To get rid of it, use some tool that does not
 insert BOMs for utf-8 encoded files to change the file encoding.

 There was a (very old) thread on django-dev that noted this behavior:
 http://groups.google.com/group/django-
 developers/browse_thread/thread/b19bd59d61a688b8/

 It proposes noting, stripping, and relocating the BOM to the front of the
 ultimately rendered template. That seems overly complicated to me, at
 least for utf-8.  But, the idea raises the question of what happens to
 included BOMs for files encoded with utf-16 or utf-32 (are these encodings
 used in practice?). Seems Django might have an issue there, especially if
 different included files had different endianness, but I don't have time
 to check in detail and it seems like a very contrived case. Perhaps Django
 could just strip the BOM from included template files?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12301#comment:6>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to