struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4352) xslt result and utf-8 characters
Date Wed, 09 Jul 2014 19:25:08 GMT

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

Hudson commented on WW-4352:
----------------------------

SUCCESS: Integrated in Struts-JDK6-develop #56 (See [https://builds.apache.org/job/Struts-JDK6-develop/56/])
WW-4352 Allows configure character encoding via param (lukaszlenart: rev e2b291f8a7b061231e43ac78241fadf96f63c77f)
* core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
* core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java
WW-4352 Adds description about new encoding param (lukaszlenart: rev fa814744dec32640bfe19444da250da7772a8079)
* core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java


> xslt result and utf-8 characters
> --------------------------------
>
>                 Key: WW-4352
>                 URL: https://issues.apache.org/jira/browse/WW-4352
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions, Other
>    Affects Versions: 2.3.16
>         Environment: windows 7
>            Reporter: Arturo Flores
>            Assignee: Lukasz Lenart
>             Fix For: 2.3.18
>
>
> copied from email in mailing list:
> I have the following in my struts.xml
> <action name="testutf8" class="TestXml">
>   <result name="success" type="xslt">
>     <param name="exposedValue">utf8</param>
>     <param name="location">testxml.xsl</param>
>   </result>
> </action>
> My testxml.xsl file looks like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" />
> <xsl:template match="result">
> <xsl:copy-of select="." />
> </xsl:template>
> </xsl:stylesheet>
> My TestXML.java file looks has the following
> public Class TestXml {
>   private String utf8="hèllo world"; // a string with utf-8 character, getters+setters
omitted here
>  
>   public String execute throws Exception {
>     return "success";
>   }
> }
> When I request /testutf8 I get the following in the browser:
> XML Parsing Error: not well-formed
> Location: http://localhost:8080/testutf8
> Line Number 1, Column 48:<?xml version="1.0" encoding="UTF-8"?><result>h�llo
world</result>
> -----------------------------------------------^
> It seems the utf-8 character is not being handled properly.  How can I make the xslt
result type handle the utf-8 character correctly?  
> Upon further investigation, the response type header is only "text/xml", it is missing
character encoding.  
> A workaround is to register a custom filter which forces utf-8 character encoding on
the output, but ideally this should be handled within struts.
> Let me know if more information is needed.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message