
| Key: |
STS-328
|
| Type: |
Improvement
|
| Status: |
Resolved
|
| Resolution: |
Fixed
|
| Priority: |
Major
|
| Assignee: |
Ben Gunter
|
| Reporter: |
Jens Illig
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
commons-fileupload-1.1,
mozilla-firefox 1.5.0.7,
ISO-8859-15-System-locale
UTF-8 jsp-encoding (also set in web.xml for stripes' LocalePicker)
commons-fileupload-1.1,
mozilla-firefox 1.5.0.7,
ISO-8859-15-System-locale
UTF-8 jsp-encoding (also set in web.xml for stripes' LocalePicker)
|
|
|
Posting the same HTML-Form with or without a single stripes:file parameter affected whether stripes:text-RequestParameter-StringProperties were injected into the ActionBean with right or wrong character encoding (German Umlaute). After some debugging I found out that net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper does:
[...]
for (FileItem item : items) {
// If it's a form field, add the string value to the list
if (item.isFormField()) {
List<String> values = params.get(item.getFieldName());
if (values == null) {
values = new ArrayList<String>();
params.put(item.getFieldName(), values);
}
values.add(item.getString());
}
// Else store the file param
else {
files.put(item.getFieldName(), item);
}
}
[...]
in its build method. I changed
[...]
values.add(item.getString());
[...]
to
[...]
values.add( (request.getCharacterEncoding() != null) ? item.getString(request.getCharacterEncoding()) : item.getString() );
[...]
and everythink works fine for me.
|
|
Description
|
Posting the same HTML-Form with or without a single stripes:file parameter affected whether stripes:text-RequestParameter-StringProperties were injected into the ActionBean with right or wrong character encoding (German Umlaute). After some debugging I found out that net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper does:
[...]
for (FileItem item : items) {
// If it's a form field, add the string value to the list
if (item.isFormField()) {
List<String> values = params.get(item.getFieldName());
if (values == null) {
values = new ArrayList<String>();
params.put(item.getFieldName(), values);
}
values.add(item.getString());
}
// Else store the file param
else {
files.put(item.getFieldName(), item);
}
}
[...]
in its build method. I changed
[...]
values.add(item.getString());
[...]
to
[...]
values.add( (request.getCharacterEncoding() != null) ? item.getString(request.getCharacterEncoding()) : item.getString() );
[...]
and everythink works fine for me. |
Show » |
|
|