[whatwg] Serialising HTML to Files in Non-Unicode Encodings

Lachlan Hunt lachlan.hunt at lachy.id.au
Wed Aug 15 07:12:19 PDT 2007


Hi,
   There is a possible issue serialising HTML fragments section [1]. 
The algorithm seems fine for use with things like innerHTML, but there 
are other issues that should be considered when serialising to a file, 
database, network stream or something.

Such serialisers should consider the character encoding.  Although a 
Unicode encoding should ideally be used, some serialisers may need to 
serialise to a different encoding at the request of the user or 
limitations of the environment.  In such cases, the serialisation should 
output appropriate character references for characters that can't be 
represented.

It should also handle outputting the appropriate <meta charset=""> 
and/or BOM, especially in environments that can't declare it at the 
transport level like HTTP can.

Perhaps the spec should say something about this issue somehwhere.

[1] http://www.whatwg.org/specs/web-apps/current-work/#serialising

-- 
Lachlan Hunt
http://lachy.id.au/



More information about the whatwg mailing list