You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Dave Thompson (Jira)" <ji...@apache.org> on 2021/05/20 12:35:09 UTC

[jira] [Closed] (DAFFODIL-2128) XML preamble encoding ignored when CLI unparsing with "xml" infoset type

     [ https://issues.apache.org/jira/browse/DAFFODIL-2128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dave Thompson closed DAFFODIL-2128.
-----------------------------------

Closed due to no activity and  no re-occurrence. If the issue re-occurs the ticket can be reopened or addressed in a new one.

> XML preamble encoding ignored when CLI unparsing with "xml" infoset type 
> -------------------------------------------------------------------------
>
>                 Key: DAFFODIL-2128
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2128
>             Project: Daffodil
>          Issue Type: Bug
>          Components: CLI
>    Affects Versions: 2.3.0
>            Reporter: Steve Lawrence
>            Assignee: Steve Lawrence
>            Priority: Major
>             Fix For: 2.4.0
>
>
> When using the CLI to unparse XML using the "xml" infoset type, we have the following code:
> {code:scala}
> case "xml" => {
>   val rdr = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(anyRef.asInstanceOf[Array[Byte]])))
>   new XMLTextInfosetInputter(rdr)
> }
> {code}
> In order to create the XMLTextInfosetInputter, we create an InputStreamReader, but we do not specify an encoding. This means the Java "file.encoding" system property will be used to decode this XML. So on machines where that property isn't UTF-8 (e.g. Windows), this can result in UTF-8 data in the XML not decoded correctly, which leads to incorrect unparsed data.
> I believe Woodstox has the ability to inspect XML and determine the encoding based on the preamble, so we should just take advantage of that. So we should change the XMLTextInfosetInputter to accept an InputStream in the constructor instead of a Reader, and deprecate the Reader constructor.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)