[
https://issues.apache.org/struts/browse/WW-826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42767
]
StarBreeze commented on WW-826:
-------------------------------
UTF-8 symbols have different length in bytes. You cannot split a byte stream
until you exactly know lengths of it char parts (in bytes).
As alternative, you may copy bytes, but then DO NOT DO new String(bytes,
encoding).
Seems the second approach is not applicable to the char's http response.
There is the good patch already: http://jira.atlassian.com/browse/JRA-13866
It solves the problem.
The bug can be reproduced by rendering a large (>8KB) block of non ANSI symbols
in the included JSP (JSP must be included by the struts include tag). Both
parent and included JSPs must have contentType="text/html; charset=UTF-8".
In this situation you may see two garbage symbols on the joint of two buffer
rendering result. Looks very unpleasant..
Please fix it ASAP.
> IncludeTag use FastByteArrayOutputStream to write the content may bring
> invalid character.
> ------------------------------------------------------------------------------------------
>
> Key: WW-826
> URL: https://issues.apache.org/struts/browse/WW-826
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: WW 2.1.7, 2.0.0
> Environment: tomcat5,windows or linux
> Reporter: fog
> Fix For: 2.0.0
>
>
> method of FastByteArrayOutputStream:
> public void writeTo(JspWriter out, String encoding) throws IOException {
> // Check if we have a list of buffers
> if (buffers != null) {
> Iterator iter = buffers.iterator();
> while (iter.hasNext()) {
> byte[] bytes = (byte[]) iter.next();
> if (encoding != null) {
> out.write(new String(bytes, encoding));
> } else {
> out.write(new String(bytes));
> }
> }
> }
> // write the internal buffer directly
> if (encoding != null) {
> out.write(new String(buffer, 0, index, encoding));
> } else {
> out.write(new String(buffer, 0, index));
> }
> }
> because blocksize is constant,a character may be separated into two buffer
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.