Hi!

=== Summary

In `xhtml.conf`, the value of `[header]` must start with `<?xml 
version="1.0" encoding="{encoding}"?>`.

=== Details

==== What actually happens

I often use input files encoded using ISO-8859-1.
To declare this to AsciiDoc, I use `:Encoding: iso-8859-1`.
When I try to locally open the asciidoc output files in Firefox, this works 
fine with backends `html` and `slidy`.
When I use `--backend=xhtml11`, Firefox complains about the file being 
invalid XML.

Firefox determines encoding like this:

1. HTTP header (does not apply to locally opening a file)
2. Byte Order Mark (for non-UTF encodings, there is no such convention 
defined)
3. XML declaration (this is currently missing, which should be fixed)
4. Fallback to UTF-8 (this is where it fails for non-UTF-8 documents)

==== What should happen

The XHTML Specification (http://www.w3.org/TR/xhtml1/#strict) says:

  An XML declaration is [...] required when the character encoding of
  the document is other than the default UTF-8 or UTF-16 and no
  encoding was determined by a higher-level protocol.

AsciiDoc-generated XHTML fails to meet this requirement.

When a file is opened locally, there is no "higher-level protocol" such as 
HTTP that might specify the encoding.
I expect AsciiDoc to produce output that is valid independently of the 
transport protocol.
To achieve this, the XML declaration is effectively required for all files 
that are encoded as neither UTF-8 nor UTF-16.
For simplicity and clarity, I'd always supply the XML encoding declaration,
even for UTF-8- or UTF-16-encoded documents that do not strictly need it..

I know that asciidoc includes this line in XHTML output:

 <meta http-equiv="Content-Type" 
content="{quirks=application/xhtml+xml}{quirks?text/html}; 
charset={encoding}" />

However, this does not help to meet the requirement.

==== Workarounds

* Locally patch asciidoc's `xhtml.conf`.
* Manually or programmatically add the XML declaration after asciidoc is 
done.

==== Solution

See the summary above.

Best Regards,  Glaeserner

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/d/optout.

Reply via email to