Hi,
I've found this library working well, except
handling non iso-8859-1 characters in form parameters. The reason is probably missing
charset in content-type header in HTTP request
sent from the browser (MSIE = NN).
javax.mail probably handles multipart well, but
without any info about charset just uses iso-8859-1 as the default.
The solution I implemented is following:
I've added a new constructor (HttpServletRequest req, String encoding) and changed handling BodyPart content in extractFormValues method.
Maybe all this is wrong, so please feel free to
kill my ides if they are wrong.
public MultipartServletRequest(HttpServletRequest req, String chenc) throws IOException, ServletException {
super();
this.character_encoding = chenc;
...
}
private void extractFormValues() {
...
ByteArrayOutputStream bos = new ByteArrayOutputStream();
InputStream is = bp.getInputStream();
int character;
while((character = is.read())!=-1){
bos.write(character);
}
value = new String(bos.toByteArray(), character_encoding);
params.put(param, value);
...
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've found this library working well, except
handling non iso-8859-1 characters in form parameters. The reason is probably missing
charset in content-type header in HTTP request
sent from the browser (MSIE = NN).
javax.mail probably handles multipart well, but
without any info about charset just uses iso-8859-1 as the default.
The solution I implemented is following:
I've added a new constructor (HttpServletRequest req, String encoding) and changed handling BodyPart content in extractFormValues method.
Maybe all this is wrong, so please feel free to
kill my ides if they are wrong.
public MultipartServletRequest(HttpServletRequest req, String chenc) throws IOException, ServletException {
super();
this.character_encoding = chenc;
...
}
private void extractFormValues() {
...
ByteArrayOutputStream bos = new ByteArrayOutputStream();
InputStream is = bp.getInputStream();
int character;
while((character = is.read())!=-1){
bos.write(character);
}
value = new String(bos.toByteArray(), character_encoding);
params.put(param, value);
...
}