[ http://issues.apache.org/struts/browse/STR-1850?page=all ]
     
David Evans closed STR-1850:
----------------------------

    Resolution: Fixed

> ResponseFilter does not handle UTF-8 encoded characters with &#
> ---------------------------------------------------------------
>
>          Key: STR-1850
>          URL: http://issues.apache.org/struts/browse/STR-1850
>      Project: Struts Action 1
>         Type: Bug

>   Components: Action
>     Versions: 1.1 Final
>  Environment: Operating System: All
> Platform: All
>     Reporter: Dave Hodson
>     Assignee: David Evans

>
> If I have a UTF-8 encoded character like "堂" (堂, a building in
> Traditional Chinese) and use this value in an html tag (e.g. html:text), the 
> '&'
> is encoded to "&", which produces output that looks like "堂" 
> The filter method should "look ahead" when it goes into the '&' case and if 
> the
> following char is '#', it should not modify the '&' char. 
> The filter method from ResponseUtils with a suggested change:
>         for (int i = 0; i < content.length; i++) {
>             switch (content[i]) {
>             case '<':
>                 result.append("&lt;");
>                 break;
>             case '>':
>                 result.append("&gt;");
>                 break;
>             case '&':
> --->          if (content[i + 1] != '#')
> --->            result.append("&amp;");
> --->          else
>                   result.append("&");
>                 break;
>             case '"':
>                 result.append("&quot;");
>                 break;
>             case '\'':
>                 result.append("&#39;");
>                 break;
>             default:
>                 result.append(content[i]);
>             }
>         }
> This probably needs a minor adjustment, as this doesn't handle the case where
> the '&' char is the last character in the String (bounds check)

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to