FasterXML / FasterXML/stax2-api

No Defaulting to UTF-8 in StartDocumentEventImpl#getCharacterEncodingScheme() without XML-Declaration

Open
#13 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
42
Forks
21
Avg merge
6h 29m
Merged PRs (30d)
1

Description

A `org.codehaus.stax2.ri.evt.StartDocumentEventImpl` instance is constructed from the values in a `XMLStreamReader` instance.

The member variable `mEncodingScheme` is set from the reader-function `#getCharacterEncodingScheme()`. JavaDoc of that function:
> Returns the character encoding declared on the xml declaration Returns null if none was declared

If there is no xml declaration in the document, `mEncodingScheme` will be `null`. In XML 1.0 a xml declaration _SHOULD_ be present, but is not required.

The JavaDoc of `javax.xml.stream.events.StartDocument`, the interface which is implemented defines the return value of the `#getCharacterEncodingScheme()`-function as follows:
> the character encoding, defaults to "UTF-8"

`org.codehaus.stax2.ri.evt.StartDocumentEventImpl#getCharacterEncodingScheme()` returns the memberVariable `mEncodingScheme`, which is `null` when the XML has no xml declaration. I would expect the default value `UTF-8`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.