How do you do a file upload in an HTML form without running into mojibake?
I have a form that has three fields:
- a file field
- a required text field
- a text field which accepts Japanese characters
I've set up my HTML form with the attribute enctype='multipart/form-data'
. But when the form submission fails due to the missing required field, I get redirected to the same page but my 2nd text field (the one that accepts the Jap. chars) is already mojibaked.
However, if I remove the enctype
or change it to anything else, and when the form submission fails, I see the Japanese chars as they are (no mojibake). The problem is, if this succeeds, I am unable to read the uploaded files.
Any ideas how to fix this??