0

I'm currently working on a web app using glassfish 4 / Java EE 7. I had an encoding problem : Glassfish default is ISO-8859-15 and I need UTF-8. Sometimes I had some weird characters but no problem with the web app working fine. So, I changed one line un my glassfish-web.xml file, I added <parameter-encoding default-charset="UTF-8"/>

Then I changed in my JSP files <%@page contentType="text/html" pageEncoding="UTF-8"%> instead of <%@page contentType="text/html" pageEncoding="ISO-8859-15"%>

Now I don't have those weird characters anymore, but since then, I have problems with POST requests when the content-type is multipart/form-data

I get an error 500, and when I look in glassfish log, I see this exception :

java.io.IOException: Corrupt form data: no leading boundary: ------WebKitFormBoundaryCgZXcxucgAjYv0sU != ------WebKitFormBoundaryCgZXcxucgAjYv0sU;charset=UTF-8

So I printed the request headers and I saw :

Header [content-type] : multipart/form-data; boundary=----WebKitFormBoundaryCgZXcxucgAjYv0sU;charset=UTF-8

It looks like it added the charset at the end of the content-type header (why not ?) but it seems to look for the wrong boundary

WebKitFormBoundaryCgZXcxucgAjYv0sU;charset=UTF-8

Obviously, I tried to remove the UTF-8 line from my glassfih-web.xml file, but it doesn't help.

Does anyone know why there is the charset in the boundary and/or how to get rid of it or how to handle it ?

Thanks a lot.

0 Answers0