Search code examples
javahtmlservletsencodingajaxform

upload file with enctype="multipart/form-data" got strange file name when the filename is Thai


I am trying to upload file using enctype="multipart/form-data" to servlet. Everything works fine with English file name but when I upload file with Thai file name, the file name get from servlet Part is not Thai.

I have tried enctype="multipart/form-data;charset:utf8" --> still not work I have tried to encode String file name with utf-8 --> still not work

Anyway to encrypt, please help

Note: I adopt ajaxForm to help submit form

$("#uploadform").ajaxForm({

Solution

  • Have you try

    request.setCharacterEncoding("UTF-8"); 
    

    in the servlet before anything else ?