[Twisted-web] EOL conversion on download using nevow.static.File

glyph at divmod.com glyph at divmod.com
Mon Feb 16 09:14:59 EST 2009

On 12:04 pm, spongelavapaul at googlemail.com wrote:
>I have a system that presents a list of text files for download and 
>these files are sat on a unix system. Windows uses are complaining 
>about the EOL of these files, so I was wondering if there was a simple 
>way to fix it as part of the download.
>The files are presented using nevow.static.File(name, 
>defaultType="text/plain"). Is there a better mime type that will 
>prompt browsers to convert? Or should I subclass n.s.File to convert 
>based on browser ID?

As far as I know, browsers don't ever do newline conversion.  You'll 
need to write some code to do this.  Subclassing static.File might be 
the way to go.

Please be aware, however, that automatic newline conversion is the cause 
of a long list of data-corruption problems with old FTP servers.  You 
might just want to tell your users to get a text editor that can 
understand UNIX newlines.

More information about the Twisted-web mailing list