Am Samstag, 24. Oktober 2015 01:25:07 UTC+2 schrieb Lex Trotman:
>
> Or a third option: submit a pull request with the change so it can be 
> made available to all users. 
>

Since it's just one line of code, I thought I already made the fix content 
available.
A pull request looked like a lot of work for little gain, both on your side 
and on mine.
It's not as if I'd claim copyright on that line.

So here's a patch done by "git format-patch -M -1", complete with 
explanatory commit message.
If the dummy email address is unacceptable, you may just insert your own:
I hereby give this patch to the public domain, with the intent of allowing 
you to simply apply it.
To apply the patch in an existing local repo, save the patch text below to 
a file in your repo, for example
 0001-Fixed-Now-adds-encoding-spec-to-xhtml-so-that-it-is-.patch
and apply it using "git am FILENAME".

>From 25db9df4ba586e703e68e6844dc9c0b66819dc89 Mon Sep 17 00:00:00 2001
From: Glaeserner Mensch <[email protected]>
Date: Thu, 19 Nov 2015 15:22:41 +0100
Subject: [PATCH] Fixed: Now adds encoding spec to xhtml, so that it is
 conformant.

For non-UTF-8 input encodings, for example an input file with
`:Encoding: iso-8859-1` at the top and non-ASCII characters in
the text, this makes XHTML output files work when opened as a file
with strict browsers, such as Firefox.
Without this change, Firefox rightfully complains about the file
being invalid XHTML and refuses to render its contents, like this:

 XML Parsing Error: not well-formed   Location: file:///C:/my.xhtml Line 
Number 1427, Column 21:
 Zusammenfassung der Änderungen
 --------------------^

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.

When a file is opened locally, there is no "higher-level protocol"
such as HTTP that might specify the encoding.
In these cases, the XML declaration is required for files
that are encoded as neither UTF-8 nor UTF-16.
AsciiDoc-generated XHTML should be valid independently of the
transport protocol. Since AsciiDoc does not know how the XHTML files
are going to be used, effectively the XML declaration is required
for all files that are encoded as neither UTF-8 nor UTF-16.

For simplicity of implementation and for clarity, we always add the XML
encoding declaration, even for UTF-8- or UTF-16-encoded documents, which
do not strictly need it.

The original issue report is here, titled "Please add XML encoding
declaration to xhtml.conf, so strict browsers can locally open xhtml":
https://groups.google.com/forum/#!topic/asciidoc/JjV-EqB9CsE
---
 xhtml11.conf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xhtml11.conf b/xhtml11.conf
index 726941c..96de5bf 100644
--- a/xhtml11.conf
+++ b/xhtml11.conf
@@ -525,6 +525,7 @@ cellspacing="0" cellpadding="4">
 </div>
 
 [header]
+<?xml version="1.0" encoding="{encoding}"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="{lang=en}">
-- 
2.5.3

-- 
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