[dancer-users] Failing to send a file in iso-8859-1

Lutz Gehlen lrg_ml at gmx.net
Fri Oct 7 07:47:55 BST 2016


Hi Pete,

On Thursday 06.10.2016 15:32:05 Peter Mottram wrote:
> On 06/10/16 15:03, Stefan Hornburg (Racke) wrote:
> > On 10/06/2016 02:56 PM, Lutz Gehlen wrote:
> >> On Wednesday 05.10.2016 20:58:22 WK wrote:
> >>> 2016-10-05 19:59 GMT+03:00 Lutz Gehlen <lrg_ml at gmx.net>:
> >>>> send_file(
> >>>> 
> >>>>     \$str,
> >>>>     content_type => 'text/csv',
> >>>>     filename     => 'foo.csv',
> >>>> 
> >>>> );
> >>>> 
> >>>> The problem is that external requirements force me to send the file
> >>>> in iso-8859-1 and it seems that I cannot manage to achieve that.
> >>> 
> >>> As far as I understand, the charset is set in config, so you could
> >>> try to override the setting in your route like:
> >>> 
> >>> set 'charset'      => 'iso-8859-1;
> >>> 
> >>> Never tried, but it should work.
> >> 
> >> Yes. this works. However, it changes charset permanently (for the
> >> current process) and I don't get the chance to change it back
> >> because send_file does not return. Is there no way to set it
> >> temporarily just for this send_file?
> > 
> > you could (re)set the charset in the "before" hook to the normal one.
> > 
> 
> There ought to be a way to set charset as an option to send_file.
> 
> I've created an issue: https://github.com/PerlDancer/Dancer2/issues/1260

You have created the issue in the Dancer2 project, is this intended?

> Lutz: could you please check this issue and add further comment if
> needed? Also let us know if you'd like to have a go at a PR. If not I'll
> create a patch.

Thank you for encouraging me to implement this myself. I'd like to give it 
a try. I might need some assistance with the pull request, though. I am 
familiar with git and have an account on github, but I have never submitted 
a pull request before.

I guess that I will fork https://github.com/PerlDancer/Dancer to my github 
account, then do my work, and then somehow submit a pull request. Is this 
the correct procedure?

How should I go about it with respect to Dancer1/Dancer2? I myself need the 
feature in Dancer1. Should I implement it there? Or both? Or is Dancer1 
even somewhat feature-frozen?

Cheers,
Lutz


More information about the dancer-users mailing list