cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24289] New: - MultipartParser cannot handle multibyte character in uploaded file name correctly
Date Fri, 31 Oct 2003 10:30:49 GMT
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);
    }

Mime
View raw message