I have a data file and a button to download the selected file.
If the file name is in Cyrillic characters, the browser says "Unknown file type", Example: I have the file "addad .png" and I click download the browser response 
there is my loading method
public void download(Files file) { try { FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); externalContext.setResponseHeader("Content-Type", "application/x-download"); externalContext.setResponseHeader("Content-Length", file.getFileContent().length+""); externalContext.setResponseHeader("Content-Disposition", "attachment;filename=\"" + file.getFilename() + "\""); externalContext.getResponseOutputStream().write(file.getFileContent()); facesContext.responseComplete(); } catch (IOException e1) { e1.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } }
im pretty sure i need to encode the file name in UTF-8 but i dont know how ... please help.
source share