I have a form in which user can upload a file and another field 'name' in which she can give any name to the file being loaded. (Please see the image in attachements) When I submit the form, the file is uploaded fine but the value in name field is messed up. I have followed all the possible suggestions I found:
1) <%@page pageEncoding="UTF-8"%> set.
2) <%@page contentType="text/html;charset=UTF-8"%> set after the first directive.
3) <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> in the head.
4) enctype="multipart/form-data" attribute in the form.
5) accept-charset="UTF-8" attribute in the form.
in the Servlet:
1) before doing any operations on request object: request.setCharacterEncoding("UTF-8");
2) Getting the value:
On the UI, I can see the characters properly but when the value is being passed to java strings, all hell breaks loose!
But nothing seems to be working.
This issue is coming in this form only where enctype is multipart/form-data. Rest everywhere having just 1) and 2) work fine.
Can someone please give some ideas what can be going wrong?