[ 
http://issues.apache.org/jira/browse/MYFACES-1011?page=comments#action_12363547 
] 

Martin Marinschek commented on MYFACES-1011:
--------------------------------------------

This is the code being executed:

    static public HtmlBufferResponseWriterWrapper getInstance(ResponseWriter 
initialWriter){
        ByteArrayOutputStream instanceStream = new ByteArrayOutputStream();
        PrintWriter instanceWriter = new PrintWriter(instanceStream, true);

        return new HtmlBufferResponseWriterWrapper(initialWriter, 
instanceStream, instanceWriter);
    }

    private HtmlBufferResponseWriterWrapper(ResponseWriter initialWriter, 
ByteArrayOutputStream stream, PrintWriter writer){
        super(writer, initialWriter==null?null:initialWriter.getContentType(), 
initialWriter==null?null:initialWriter.getCharacterEncoding());
        this.stream = stream;
        this.writer = writer;
    }

where the initialWriter is the normal facesContext responseWriter.

I don't see why this shouldn't work - can you debug through and see if the 
correct encoding is passed in?

regards,

Martin

> <t:buffer> does not support East Asia characters using UTF-8 encoding
> ---------------------------------------------------------------------
>
>          Key: MYFACES-1011
>          URL: http://issues.apache.org/jira/browse/MYFACES-1011
>      Project: MyFaces
>         Type: Bug
>   Components: Tomahawk
>     Versions: Nightly
>  Environment: Windows XP, JBoss 4.0.3SP1
>     Reporter: Dave
>     Priority: Blocker

>
> East Asia characters support using UTF-8 encoding (request and response). 
> When rendering into a <t:buffer>, some data conversion  corrupts the encoding.
> -------
> It was <t:buffer> that caused the encoding problem. I used <t:buffer> in my 
> code.
>  
> I tried the following simple example without <t:buffer>, it worked fine 
> without problem in typing/displaying back East asia characters. If I wrap the 
> code with <t:buffer>, and output the buffer, it will not work, displaying  
> East Asia characters back as question marks.
>  
> I thought <t:buffer> is just a piece of memory without any character 
> conversion. How does <t:buffer> work exactly? what OutputStream is being 
> used? is it possibly involving data conversion? If yes, is there any 
> workaround?
>  
> Thanks!
>  
> ------------without <t:buffer>, works!----
>  
> <%@ page contentType="text/html; charset=UTF-8"%>
> <%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t"%>
> <HTML>
> <head>
> </head>
> <f:view>
> <h:outputText value="#{testBean.name}" />
> <h:form>
> <h:inputText value="#{testBean.name}"/>
> <h:commandButton value="Submit" />
> </h:form>
> </f:view>
> </HTML>
>  
> ------------------------------------use <t:buffer>, does not work ----
>  
> <%@ page contentType="text/html; charset=UTF-8"%>
> <%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t"%>
> <HTML>
> <head>
> </head>
> <f:view>
> <t:buffer into="#{buf}"> 
> <h:outputText value="#{testBean.name}" />
> <h:form>
> <h:inputText value="#{testBean.name}"/>
> <h:commandButton value="Submit" />
> </h:form>
> </t:buffer>
> <h:outputText value="#{buf}" escape="false" />
> </f:view>
> </HTML>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to