[jira] [Commented] (COCOON3-83) Encoding bug in XMLGenerator (SAX version) when passing a String to the constructor

2011-12-12 Thread Hudson (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/COCOON3-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167483#comment-13167483
 ] 

Hudson commented on COCOON3-83:
---

Integrated in Cocoon-trunk #110 (See 
[https://builds.apache.org/job/Cocoon-trunk/110/])
COCOON3-83 #resolve

ilgrosso : http://svn.apache.org/viewvc/?view=rev&rev=1213207
Files : 
* 
/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLGenerator.java


> Encoding bug in XMLGenerator (SAX version) when passing a String to the 
> constructor
> ---
>
> Key: COCOON3-83
> URL: https://issues.apache.org/jira/browse/COCOON3-83
> Project: Cocoon 3
>  Issue Type: Bug
>  Components: cocoon-sax
>Affects Versions: 3.0.0-alpha-3
>Reporter: JBert
>Assignee: Francesco Chicchiriccò
> Fix For: 3.0.0-beta-1
>
>
> When creating a new org.apache.cocoon.sax.component.XMLGenerator instance 
> with a String argument, the execute method will fail when the XML uses 
> non-ASCII characters.
> See http://stackoverflow.com/a/8471886/983949 for more info with regards to 
> the code.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (COCOON3-83) Encoding bug in XMLGenerator (SAX version) when passing a String to the constructor

2011-12-12 Thread JBert (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/COCOON3-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167455#comment-13167455
 ] 

JBert commented on COCOON3-83:
--

The problem would appear to be in the StringGenerator inner class, in version 
3.0.0-alpha 3 the problem is on line 322:

{code}
XMLUtils.toSax(new ByteArrayInputStream(this.xmlString.getBytes()), 
XMLGenerator.this.getSAXConsumer());
{code}

This encodes the String to bytes using the JRE platform encoding. A SAX parser 
will later have trouble parsing this bytestream when the XML declares an 
encoding different from the platform encoding.

If I look at line 149, there's this:
{code}
 XMLUtils.toSax(new String(this.bytes, this.encoding), 
XMLGenerator.this.getSAXConsumer());
{code}

This issue could thus be fixed by simply passing the XML String into the toSax 
function, like so:

{code}
 XMLUtils.toSax(this.xmlString, XMLGenerator.this.getSAXConsumer());
{code}

> Encoding bug in XMLGenerator (SAX version) when passing a String to the 
> constructor
> ---
>
> Key: COCOON3-83
> URL: https://issues.apache.org/jira/browse/COCOON3-83
> Project: Cocoon 3
>  Issue Type: Bug
>  Components: cocoon-sax
>Affects Versions: 3.0.0-alpha-3
>Reporter: JBert
>
> When creating a new org.apache.cocoon.sax.component.XMLGenerator instance 
> with a String argument, the execute method will fail when the XML uses 
> non-ASCII characters.
> See http://stackoverflow.com/a/8471886/983949 for more info with regards to 
> the code.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira