You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Michael Holtermann (JIRA)" <ji...@apache.org> on 2019/01/15 08:52:00 UTC

[jira] [Created] (XALANJ-2619) XalanJ does not support UTF-16LE

Michael Holtermann created XALANJ-2619:
------------------------------------------

             Summary: XalanJ does not support UTF-16LE
                 Key: XALANJ-2619
                 URL: https://issues.apache.org/jira/browse/XALANJ-2619
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects.  Anybody can view the issue.)
          Components: Serialization
    Affects Versions: 2.7.2
            Reporter: Michael Holtermann
            Assignee: Steven J. Hathaway


The Xalan Serializer does not support UTF-16LE. UTF-16 is supported.

*To reproduce*
Create a stylesheet containing
{code}
<xsl:output method="text" version="1.0" media-type="text/csv"
		encoding="UTF-16LE" />
{code}

This will cause a warning on transformation on {{System.out}}:
{noformat}
Warning:  The encoding 'UTF-16LE' is not supported by the Java runtime.
Warning: encoding "UTF-16LE" not supported, using UTF-8
{noformat}
caused by {{org.apache.xml.serializer.ToStream.setProp(String, String, boolean)}}.

With serializer-2.7.0, only the first line of the warning was printed, but the file was rendered in UTF-16LE.

UTF-16LE should be supported by any JVM, see {{java.nio.charset.StandardCharsets.UTF_16LE}}.

If I add 
{noformat}
UTF-16LE    UTF-16LE
{noformat}
to the {{Encodings.properties}} file, it works as expected.

*Proposed Solution*
Please add UTF-16LE to {{Encodings.properties}}.

*Side note*
{{org.apache.xml.serializer.Encodings.loadEncodingInfo()}} refers to a System Property "encodings" that could be used to overwrite the location of the {{Encodings.properties}}. That code contribution has been removed with XALANJ-2220, so currently it's impossible to provide an alternative {{Encoding.properties}}.

*Use Case*
To be able to open a CVS with one click in a German localized MS Excel, the file must be encoded in UTF-16LE with BOM and use the column-separator "&#x9;" (tab).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xalan.apache.org
For additional commands, e-mail: dev-help@xalan.apache.org