I ran into a problem when I call request.getParameter( "filename" )
in a HttpServletRequest in GWT. Here's the code how i encode the URL:
String sFile = URL.encodeQueryString( "°^!§$%()=`´' glassfish +~#'@€-_²³.pdf" );
String sURL = GWT.getModuleBaseURL() + "filehttpservice" // name of the httpservlet
+ "?filename=" + sFile; // the name of the file to download
Window.open( sURL, "_blank", sFeatures ); // sFeatures are some window-settings
So i want to download a file with some special characters in its name. The URL-encoded name is:
%C2%B0%5E!%C2%A7%24%25()%3D%60%C2%B4'%20glassfish%20%2B~%23'%40%E2%82%AC-_%C2%B2%C2%B3.pdf
which is correct, cause I can call the file directly in the browser with this name.
So when the request comes to the get-Method of the HttpServlet i want to extract the filename from its parameters with the following code:
request.setCharacterEncoding( "UTF-8" );
String sFilename = request.getParameter( "filename" );
But the received Filename is:
°^!§$%()=`´' glassfish +~#'@â¬-_²³.pdf
which is totally wrong.
I have searched for a long time and tried serveral solutions but it changes nothing. Does anybody have an idea how i can receive the correct filename?