You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2003/10/31 11:30:49 UTC
DO NOT REPLY [Bug 24289] New: -
MultipartParser cannot handle multibyte character in uploaded file name correctly
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24289>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24289
MultipartParser cannot handle multibyte character in uploaded file name correctly
Summary: MultipartParser cannot handle multibyte character in
uploaded file name correctly
Product: Cocoon 2
Version: Current CVS 2.1
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: Normal
Priority: Other
Component: core
AssignedTo: dev@cocoon.apache.org
ReportedBy: quanz@rizon.com.cn
MultipartParser use readln() read headers line from the TokenStream,but it
suppose every byte is a char,so we can get the correct filename while filename
is multibyte character,may be it could be fixed by change it like this
private String readln(TokenStream in) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
int b = in.read();
while ((b != -1) && (b != '\r')) {
out.write(b);
b = in.read();
}
if (b == '\r') {
in.read(); // read '\n'
}
out.close();
return new String(out.toByteArray(), this.characterEncoding);
}
and also need fix HttpRequest#getParameter,for we already got the correct
filename
public String getParameter(String name) {
String value = this.req.getParameter(name);
if (this.form_encoding == null || value == null) {
return value;
}
if(this.req instanceof MultipartHttpServletRequest)
return value;
else
return decode(value);
}