Escaping filename in http response

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fuzzyman

    #1

    Escaping filename in http response

    I know I *could* look this up in the relevant RFC... but I thought
    someone might know it off the top of their head.

    I'm offering files for download via a CGI. I am inserting the filename
    into the relevant http header. Where the filename contains spaces
    firefox truncates it - which is probably correct behaviour for firefox
    - but annoying :-)

    Which is the right function to escape the filename urllib.quote or
    urllib.quote_pl us ?

    It's probably quote_plus..... .. (and I'll probably try both later...
    but someone might answer before that)

    :-)

    Thanks
    Fuzzyman
    http://www.voidspace.org.uk/python/index.shtml

  • Richard Brodie

    #2
    Re: Escaping filename in http response


    "Fuzzyman" <fuzzyman@gmail .com> wrote in message
    news:1110817166 .956220.179710@ l41g2000cwc.goo glegroups.com.. .
    [color=blue]
    > Which is the right function to escape the filename urllib.quote or
    > urllib.quote_pl us ?[/color]

    Neither. Just drop quotes around it, after having sanitized it
    (assuming it's plain ASCII). Alternatively you could use the
    email package for MIME stuff like this.


    Comment

    • Fuzzyman

      #3
      Re: Escaping filename in http response

      Nice one - thanks.

      Fuzzy
      http://www.voidspace.org.uk/python/index.shtml

      Comment

      Working...