Greetings
I have written a responseFilter on "/p8/getDocument" service. When document action is performed, I am fetching the document and then using the RetrievalName from the content elements. I am using this RetrievalName for the FileName. I am also encoding the filename as per the UTF-8 standard to handle the special characters and german characters. Below is the code that I used to encode it :
String filename=URLEncode.encode(document.get_Name + fileExt, "UTF-8").replace("+"," ");
response.setHeader("content-disposition",MessageFormat.format("attachment;filename="+filename));
I guess I am encoding the filename in the response filter so when document is opened through checkout operation, I need to decode it.
Please suggest if this is correct and where I can handle it
Thanks
Answer by Calvin_Zhang (671) | Aug 16, 2018 at 11:59 PM
Hi, May the filename not be encoded by URLEncode works?
@Calvin_Zhang no, I get an error that document cannot be downloaded as the filename has some german characters Please suggest
I check ICN code and it set as: attachment; filename*=UTF-8''%C3%9Cberpr%C3%BCfung%20Solvency%20II-%20Leitlinien%202018-Unterlagen%20%E2%80%93%20Leitlinie%20Governance%20und%20Interne%20KontrolleKontrolle.txt I use a file named: Überprüfung Solvency II- Leitlinien 2018-Unterlagen – Leitlinie Governance und Interne KontrolleKontrolle.txt
without RE
@Calvin_Zhang : thanks for the help How can I avoid these encoded characters while the file is opened after checkout. I don't get these encoded characters while I download it.
Please suggest
Answer by ICNDeveloper (24) | Sep 13, 2018 at 07:57 AM
@Calvin_Zhang and @Gabriel Garcia
I see the same issue when I send a document via email. Actually the response filter gets called in this scenarios as well. Is it possible to somehow decode the fileName
Thanks