viritin / flow-viritin

Viritin inspired project for Vaadin Flow
Other
39 stars 15 forks source link

DynamicFileDownloader unable save file with non ascii names #49

Closed MaximKulikov closed 3 months ago

MaximKulikov commented 3 months ago

DynamicFileDownloader.java handler allow only filenames with ASCII style.

if you change this line DynamicFileDownloader.java:309 response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");

for something like this:

response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''"+ URLEncoder.encode(filename, StandardCharsets.UTF_8) );

browsers will handle utf-8 filenames.

mstahv commented 3 months ago

Thanks, sounds about right, cutting a fixed release still today. Would you post some characters that don't work so I can improve the test? My ä & ö probably worked also without the fix because of the default iso8859 used for http headers....

MaximKulikov commented 2 months ago

I used cyrilicc letter (any not work), but in term of iso8859 it same as any arabic, but with arabic you could ussualy test right2left text direction. foo bar شريط ف фу бар 富酒吧 फू बार