KnpSnappyBundle
KnpSnappyBundle copied to clipboard
Provide support for filenames with special characters.
Hi there! :wave:
Version used
knplabs/knp-snappy-bundle v1.10.0
Issue Description
I am encountering an issue when trying to include special characters (Ä, Å, ...) in my filename using the SnappyResponse
class from knplabs/knp-snappy-bundle
. The problem lies in how the Content-Disposition
header is set in the following code snippet:
$this->headers->add(['Content-Disposition' => $this->headers->makeDisposition($contentDisposition, $fileName)]);
The issue arises when my filename (the $fileName variable) contains non-ASCII characters. While it's possible to pass an ASCII-only string to makeDisposition()
, this limitation prevents the use of filenames with special characters.
Proposed solution
I suggest updating the SnappyResponse class (and its extending classes) to include an optional $fileNameFallback variable. This additional parameter would also be passed to the makeDisposition(...) method, allowing for the use of filenames with special characters. This improvement would eliminate the need for users to manually set the Content-Disposition header as the only current solution I currently know of.
Thanks!
Thanks in advance for considering this enhancement. If additional information is required or if you have any questions, please feel free to ask! :smile: