On 23 October 2015 at 23:09, Glaeserner Mensch <[email protected]> wrote: > 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)
This is correct, though it should also read the meta tag in the head entity. Old versions of a certain browser (won't name Internet Explorer :) would not accept the xml entity and only accepted the meta entity, so the xml tag was omitted (at least IIUC, before my time). > > ==== 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. Or a third option: submit a pull request with the change so it can be made available to all users. Cheers Lex > > ==== 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. -- 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.
