398337 UTF-16 percent encoding in UTF-16 form content

This commit is contained in:
Greg Wilkins 2013-01-17 09:04:04 +11:00
parent c4e77feefa
commit 747eeb87c1
2 changed files with 6 additions and 6 deletions

View File

@ -580,7 +580,7 @@ public class UrlEncoded extends MultiMap implements Cloneable
StringWriter buf = new StringWriter(8192);
IO.copy(input,buf,maxLength);
decodeTo(buf.getBuffer().toString(),map,ENCODING,maxKeys);
decodeTo(buf.getBuffer().toString(),map,StringUtil.__UTF16,maxKeys);
}
/* -------------------------------------------------------------- */

View File

@ -174,16 +174,16 @@ public class URLEncodedTest
{
String [][] charsets = new String[][]
{
{StringUtil.__UTF8,null},
{StringUtil.__ISO_8859_1,StringUtil.__ISO_8859_1},
{StringUtil.__UTF8,StringUtil.__UTF8},
{StringUtil.__UTF16,StringUtil.__UTF16},
{StringUtil.__UTF8,null,"%30"},
{StringUtil.__ISO_8859_1,StringUtil.__ISO_8859_1,"%30"},
{StringUtil.__UTF8,StringUtil.__UTF8,"%30"},
{StringUtil.__UTF16,StringUtil.__UTF16,"%00%30"},
};
for (int i=0;i<charsets.length;i++)
{
ByteArrayInputStream in = new ByteArrayInputStream("name\n=value+%30&name1=&name2&n\u00e3me3=value+3".getBytes(charsets[i][0]));
ByteArrayInputStream in = new ByteArrayInputStream(("name\n=value+"+charsets[i][2]+"&name1=&name2&n\u00e3me3=value+3").getBytes(charsets[i][0]));
MultiMap m = new MultiMap();
UrlEncoded.decodeTo(in, m, charsets[i][1], -1,-1);
System.err.println(m);