Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with fileupload and the fields with non-latin chars #83

Closed
kolyvan opened this issue Aug 8, 2011 · 1 comment
Closed

problem with fileupload and the fields with non-latin chars #83

kolyvan opened this issue Aug 8, 2011 · 1 comment
Assignees
Labels
Milestone

Comments

@kolyvan
Copy link

kolyvan commented Aug 8, 2011

The problem in FileUploadSupport.extractMultipartParams()

 if (item.isFormField)
  BodyParams(params.fileParams, params.formParams + ((item.getFieldName, item.getString // < here

FileItem.getString returns string in "ISO-8859-1" latin encoding.
if there is a text field on a form with non-latin chars then this method returns a broken string .

Possible fix it's to pass a charset name into getString method: item.getString("UTF-8")

@ghost ghost assigned rossabaker Aug 8, 2011
@rossabaker
Copy link
Member

This is a thorny problem. Browsers aren't usually explicit about the charset of form parts, and the actual encoding is browser-specific and may depend on attributes of the form being submitted. Imperfect solution:

  1. Look for a charset on the form part. If it's set, trust it.
  2. Otherwise, default to the kernel's defaultCharacterEncoding (which itself defaults to UTF-8).
  3. Provide fileItemToString hook so apps can apply custom hacks as necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants