You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Bohdan Mushkevych (JIRA)" <ji...@apache.org> on 2006/11/09 17:35:38 UTC
[jira] Commented: (COCOON-1950)
org.apache.cocoon.blocks.util.RequestParameters incorrectly parses
Multi-byte symbols
[ http://issues.apache.org/jira/browse/COCOON-1950?page=comments#action_12448512 ]
Bohdan Mushkevych commented on COCOON-1950:
-------------------------------------------
Following fix is proposed
Instead of
try {
sb.append((char) Integer.parseInt(s.substring(i+1, i+3),
16));
i += 2;
} catch (NumberFormatException e) {
place
try {
if (s.charAt(i+1) == 'u') {
// working with multi-byte symbols in format %uXXXX
sb.append((char) Integer.parseInt(s.substring(i+2, i+6), 16));
i += 5; // 4 ditital and 1 symbol u
} else {
// working with sigle-byte symbols in format %YY
sb.append((char) Integer.parseInt(s.substring(i+1, i+3), 16));
i += 2;
}
} catch (NumberFormatException e) {
> org.apache.cocoon.blocks.util.RequestParameters incorrectly parses Multi-byte symbols
> -------------------------------------------------------------------------------------
>
> Key: COCOON-1950
> URL: http://issues.apache.org/jira/browse/COCOON-1950
> Project: Cocoon
> Issue Type: Bug
> Components: * Cocoon Core
> Affects Versions: 2.1.8, 2.1.9
> Reporter: Bohdan Mushkevych
>
> In cases, when request comes in unicode and contains both single byte and multi byte symbols, Cocoon processes them incorrectly
> The validator crashes with the requst like:
> http://localhost:8080/service?navigationID=/media/mmc2
> &selectionIDList=420000000000053228%09420000000000053227%09420000000000053226%09420000000000053225
> &selectionIDListDisp=%u4F0F%u5C14%u52A0%09%u4F0F%u5C14%u52A0%20%3E%20%u673A%u52A8%u8F66%09%u4F0F%u5C14%u52A0%20%3E%20%u673A%u52A8%u8F66%20%3E%20%u658B%09%u4F0F%u5C14%u52A0%20%3E%20%u673A%u52A8%u8F66%20%3E%20%u658B%20%3E%20%u5149%u5B66%u8BC6%u522B%u7CFB%u7EDF
> &selectionTopNList=420000000000053228%09%u4F0F%u5C14%u52A0%09420000000000053227%09%u4F0F%u5C14%u52A0%20%3E%20%u673A%u52A8%u8F66%09420000000000053226%09%u4F0F%u5C14%u52A0%20%3E%20%u673A%u52A8%u8F66%20%3E%20%u658B%09420000000000053225%09%u4F0F%u5C14%u52A0%20%3E%20%u673A%u52A8%u8F66%20%3E%20%u658B%20%3E%20%u5149%u5B66%u8BC6%u522B%u7CFB%u7EDF&
> As it stands from the code below, parseName method symply extracts 2 characters after % and works ok with pattrens %YY
> however, it does not handle %uXXXX correctly:
> private String parseName(String s)
> {
> StringBuffer sb = new StringBuffer();
> for(int i = 0; i < s.length(); i++)
> {
> char c = s.charAt(i);
> switch(c)
> {
> case 43: // '+'
> sb.append(' ');
> break;
> case 37: // '%'
> try
> {
> sb.append((char)Integer.parseInt(s.substring(i + 1, i + 3), 16));
> i += 2;
> break;
> ...
--
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