You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Justin Dearing <zi...@gmail.com> on 2007/10/30 15:21:00 UTC
xerces-c createdocs.bat and the BOM character
Folks,
I was editing the documentation using XML Copy Editor and I was getting an
error when I ran createdocs.bat. I eventually tracked the error down to it
inserting a BOM character at the beginning of the document. Gerald, the
author of XML copy editor seems to think the BOM should be there as the docs
are UTF-8 and it is a UTF-8 BOM. I'm not sure what the encoding is or if
TortioseSVN is altering the encoding. I have a few questions regarding this:
1) What is the intended encoding of the documentation? Since the documents
are written in English my understanding is UTF-8 would work just fine but I
don't know a lot about unicode.
2) Does the java tool that builds the documentation handle BOMs correctly
for UTF-8 or is my editor at fault.
3) As a developer working on a windows platform how would I get encoding
information about a file?
4) As a developer working on a unix platform how would I get encoding
information about a file?
It seems the answers to 3 and 4 is there is no easy answer.
Re: xerces-c createdocs.bat and the BOM character
Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Scott Morgan <bl...@blueyonder.co.uk> writes:
> http://unicode.org/faq/utf_bom.html#25
>
> "a BOM can be used as a signature no matter how the Unicode text is
> transformed: UTF-16, UTF-8, UTF-7, etc. The exact bytes comprising the
> BOM will be whatever the Unicode character FEFF is converted into by
> that transformation format. In that form, the BOM serves to indicate
> both that it is a Unicode file, and which of the formats it is in."
I guess this illustrates a major difference between mathematics and
software. In math if someone tells you that 2 + 2 = 5 then you can
call BS without looking into any external sources. In software, if
someone tells you there is a byte order marker for encoding which
by definition does not have a notion of byte order, you actually
need to check whether some "standards body" came up with such a
thing. I can't seem to learn the lesson ;-).
Boris
--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: xerces-c createdocs.bat and the BOM character
Posted by Scott Morgan <bl...@blueyonder.co.uk>.
Boris Kolpackov wrote:
> There is no such thing as BOM for UTF-8.
>
http://unicode.org/faq/utf_bom.html#25
"a BOM can be used as a signature no matter how the Unicode text is
transformed: UTF-16, UTF-8, UTF-7, etc. The exact bytes comprising the
BOM will be whatever the Unicode character FEFF is converted into by
that transformation format. In that form, the BOM serves to indicate
both that it is a Unicode file, and which of the formats it is in."
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: xerces-c createdocs.bat and the BOM character
Posted by David Bertoni <db...@apache.org>.
Justin Dearing wrote:
> On 10/30/07, David Bertoni <db...@apache.org> wrote:
>> It would help to see the error message you're getting, and to know what
>> tool is issuing it.
>
> My apologies. This is the java tool building version 2 of the xerces-c
> library on windows of course
>
> [XalanProcessor] Applying XSL sheet "sbk:/style/stylesheets/any2project.xsl"
> [XercesParser] The markup in the document preceding the root element must be wel
> l-formed. [File: "sbk:/sources/build-winunix.xml" Line: 1 Column: 1]
> org.apache.stylebook.CreationException: SAXException caught while parsing
I would be willing to bet stylebook is using Xerces-J 1.x, which is
probably buggy. Your best bet is to just manually strip the UTF-8 BOM from
the files.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: xerces-c createdocs.bat and the BOM character
Posted by Justin Dearing <zi...@gmail.com>.
On 10/30/07, David Bertoni <db...@apache.org> wrote:
> It would help to see the error message you're getting, and to know what
> tool is issuing it.
My apologies. This is the java tool building version 2 of the xerces-c
library on windows of course
[XalanProcessor] Applying XSL sheet "sbk:/style/stylesheets/any2project.xsl"
[XercesParser] The markup in the document preceding the root element must be wel
l-formed. [File: "sbk:/sources/build-winunix.xml" Line: 1 Column: 1]
org.apache.stylebook.CreationException: SAXException caught while parsing
at org.apache.stylebook.parsers.XercesParser.parse(XercesParser.java:55)
at org.apache.stylebook.parsers.CachingParser.parse(CachingParser.java:9
2)
at org.apache.stylebook.parsers.AbstractParser.parse(AbstractParser.java
:28)
at org.apache.stylebook.producers.ParserProducer.produce(ParserProducer.
java:26)
at org.apache.stylebook.Project.processEntry(Project.java:110)
at org.apache.stylebook.Project.processNodeList(Project.java:54)
at org.apache.stylebook.Project.<init>(Project.java:42)
at org.apache.stylebook.Loader.load(Loader.java:57)
at org.apache.stylebook.StyleBook.getProject(StyleBook.java:122)
at org.apache.stylebook.StyleBook.main(StyleBook.java:85)
[StyleBook] Caught org.apache.stylebook.LoadingException
org.apache.stylebook.LoadingException: Processing Entry (SAXException caught whi
le parsing)
at org.apache.stylebook.Project.processEntry(Project.java:126)
at org.apache.stylebook.Project.processNodeList(Project.java:54)
at org.apache.stylebook.Project.<init>(Project.java:42)
at org.apache.stylebook.Loader.load(Loader.java:57)
at org.apache.stylebook.StyleBook.getProject(StyleBook.java:122)
at org.apache.stylebook.StyleBook.main(StyleBook.java:85)
[StyleBook] Error creating project
Java version:
C:\Documents and Settings\justin.dearing\My Documents\xerces>java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: xerces-c createdocs.bat and the BOM character
Posted by David Bertoni <db...@apache.org>.
Justin Dearing wrote:
> Thank you all for you quick responses.
>
> On 10/30/07, Jesse Pelton <js...@pkc.com> wrote:
>> Actually, the XML spec discusses the UTF-8 BOM. See
>> http://www.w3.org/TR/2006/REC-xml-20060816/#sec-guessing-no-ext-info.
>>
>> Whether it makes sense is another question. I suppose it could be used
>> to quickly distinguish UTF-8 from ASCII and similar encodings. Since
>> conforming processors are required to handle UTF-8 and UTF-16, but no
>> other encodings, this might have some value.
>>
>
> It seems to me, and I'm not an expert on unicode at all, that it would
> make sense for the doc building tools to handle the UTF-8 BOM
> character if it sometimes gets inserted there. If for the sake of
> consistency you want to explicitly forbid UTF-8 BOMs in the
> documentation source, but want to make the error thrown more clear you
> could do the following. The current exception that gets thrown should
> be caught, and become the InnerException of an exception with the
> message of "This document has a UTF-8 BOM character. Xerces
> Documentation source files should not contain a UTF-8 BOM character."
Any XML-compliant processor should handle documents with a UTF-8 BOM.
However, documents with a UTF-8 BOM are not that common, so there may be a
bug somewhere. In fact, Xerces-C had a bug where we would not always
handle the BOM correctly.
>
> I now know to change a checkbox on XML copy editor to prevent the
> issue from affecting me. I will talk to Gerald about default behavior
> of XML Copy Editor. However, GVIM, handles the file with or without
> the BOM and I couldn't figure out what the problem was until I
> generated a diff which rendered the BOM as a 2 printable characters in
> the text file since it was no longer the first byte sequence in the
> file. TortoiseMerge, and WinMerge both indicate the first line is
> changed but do not illustrate the BOM character, which is a bug on
> their part so I will report that to their respective maintainers.
It would help to see the error message you're getting, and to know what
tool is issuing it.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: xerces-c createdocs.bat and the BOM character
Posted by Justin Dearing <zi...@gmail.com>.
Thank you all for you quick responses.
On 10/30/07, Jesse Pelton <js...@pkc.com> wrote:
> Actually, the XML spec discusses the UTF-8 BOM. See
> http://www.w3.org/TR/2006/REC-xml-20060816/#sec-guessing-no-ext-info.
>
> Whether it makes sense is another question. I suppose it could be used
> to quickly distinguish UTF-8 from ASCII and similar encodings. Since
> conforming processors are required to handle UTF-8 and UTF-16, but no
> other encodings, this might have some value.
>
It seems to me, and I'm not an expert on unicode at all, that it would
make sense for the doc building tools to handle the UTF-8 BOM
character if it sometimes gets inserted there. If for the sake of
consistency you want to explicitly forbid UTF-8 BOMs in the
documentation source, but want to make the error thrown more clear you
could do the following. The current exception that gets thrown should
be caught, and become the InnerException of an exception with the
message of "This document has a UTF-8 BOM character. Xerces
Documentation source files should not contain a UTF-8 BOM character."
I now know to change a checkbox on XML copy editor to prevent the
issue from affecting me. I will talk to Gerald about default behavior
of XML Copy Editor. However, GVIM, handles the file with or without
the BOM and I couldn't figure out what the problem was until I
generated a diff which rendered the BOM as a 2 printable characters in
the text file since it was no longer the first byte sequence in the
file. TortoiseMerge, and WinMerge both indicate the first line is
changed but do not illustrate the BOM character, which is a bug on
their part so I will report that to their respective maintainers.
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
RE: xerces-c createdocs.bat and the BOM character
Posted by Jesse Pelton <js...@PKC.com>.
Actually, the XML spec discusses the UTF-8 BOM. See
http://www.w3.org/TR/2006/REC-xml-20060816/#sec-guessing-no-ext-info.
Whether it makes sense is another question. I suppose it could be used
to quickly distinguish UTF-8 from ASCII and similar encodings. Since
conforming processors are required to handle UTF-8 and UTF-16, but no
other encodings, this might have some value.
-----Original Message-----
From: Boris Kolpackov [mailto:boris@codesynthesis.com]
Sent: Tuesday, October 30, 2007 10:37 AM
To: c-dev@xerces.apache.org
Subject: Re: xerces-c createdocs.bat and the BOM character
Hi Justin,
Justin Dearing <zi...@gmail.com> writes:
> Gerald, the author of XML copy editor seems to think the BOM should be
> there as the docs are UTF-8 and it is a UTF-8 BOM.
BOM (byte order marker) does not make any sense for UTF-8 since it is
a 1-byte encoding.
> 1) What is the intended encoding of the documentation? Since the
documents
> are written in English my understanding is UTF-8 would work just fine
but I
> don't know a lot about unicode.
UTF-8.
> 2) Does the java tool that builds the documentation handle BOMs
correctly
> for UTF-8 or is my editor at fault.
There is no such thing as BOM for UTF-8.
> 3) As a developer working on a windows platform how would I get
encoding
> information about a file?
I assume you are talking about .xml files in the doc/ directory. In this
case: those XML file do not explicitly state their encoding (in XML
declaration) so it defaults to UTF-8.
> 4) As a developer working on a unix platform how would I get encoding
> information about a file?
Ditto.
Boris
--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: xerces-c createdocs.bat and the BOM character
Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Justin,
Justin Dearing <zi...@gmail.com> writes:
> Gerald, the author of XML copy editor seems to think the BOM should be
> there as the docs are UTF-8 and it is a UTF-8 BOM.
BOM (byte order marker) does not make any sense for UTF-8 since it is
a 1-byte encoding.
> 1) What is the intended encoding of the documentation? Since the documents
> are written in English my understanding is UTF-8 would work just fine but I
> don't know a lot about unicode.
UTF-8.
> 2) Does the java tool that builds the documentation handle BOMs correctly
> for UTF-8 or is my editor at fault.
There is no such thing as BOM for UTF-8.
> 3) As a developer working on a windows platform how would I get encoding
> information about a file?
I assume you are talking about .xml files in the doc/ directory. In this
case: those XML file do not explicitly state their encoding (in XML
declaration) so it defaults to UTF-8.
> 4) As a developer working on a unix platform how would I get encoding
> information about a file?
Ditto.
Boris
--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org