cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir S Bronnikov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COCOON-2093) Servlet Service Transformer fail with error Invalid byte 2 of 2-byte UTF-8 sequence.
Date Fri, 20 Jul 2007 10:12:06 GMT

    [ https://issues.apache.org/jira/browse/COCOON-2093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12514163
] 

Vladimir S Bronnikov commented on COCOON-2093:
----------------------------------------------

I find following:

Class org.apache.cocoon.servletservice.postable.components.ServletServiceTransformer copy
XML from input to output using IOUtils.copy (see string number 87). This method use object
"OutputStreamWriter" for writing characters.
But this method have no parameter for encoding output stream. Then object OutputStreamWriter
set default system encoding (may differ from UTF-8).
I correct source code of ServletServiceTransformer and replace "copy" method on:
IOUtils.copy(new StringReader(xml), servletSource.getOutputStream(),"UTF-8");

Then on output we have output stream with UTF-8 encoding.
Is this a decision? May you correct source code?

> Servlet Service Transformer fail with error Invalid byte 2 of 2-byte UTF-8 sequence.
> ------------------------------------------------------------------------------------
>
>                 Key: COCOON-2093
>                 URL: https://issues.apache.org/jira/browse/COCOON-2093
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core, - Components: Sitemap, - Servlet service framework
>            Reporter: Vladimir S Bronnikov
>             Fix For: 2.2-dev (Current SVN)
>
>         Attachments: servletservice.zip
>
>
> Hello!
> I create two cocoon block such as in this article: "Modularize Cocoon apps (Using blocks)"
(http://cocoon.zones.apache.org/dev-docs/2.2/1291_1_1.html) in section "Use a pipeline fragment".
> Only difference is that file "demo/welcome.xml" contain russian symbols (but in UTF-8
encoding - 100%). After point my browser at http://localhost:8888/myBlock1/callingTransformationService
I see this exception:
> Caused by: org.xml.sax.SAXParseException: Invalid byte 2 of 2-byte UTF-8 sequence.
> 	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
> 	at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
> 	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> 	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> 	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> 	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> 	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> 	at org.apache.cocoon.core.xml.impl.JaxpSAXParser.parse(JaxpSAXParser.java:196)
> 	at org.apache.cocoon.core.xml.impl.JaxpSAXParser.parse(JaxpSAXParser.java:204)
> 	at org.apache.cocoon.core.xml.avalon.DefaultSAXParser.parse(DefaultSAXParser.java:54)
> 	at org.apache.cocoon.components.source.util.SourceUtil.parse(SourceUtil.java:238)
> 	at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:109)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ...
> What's wrong? Where can I set correct encoding (UTF-8)?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message