473,702 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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)



Jul 18 '05 #1
2 2176

"Fuzzyman" <fu******@gmail .com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.com.. .
Which is the right function to escape the filename urllib.quote or
urllib.quote_pl us ?

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.
Jul 18 '05 #2
Nice one - thanks.


Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: SW | last post by:
I have an ASP page that causes Excel to be loaded on the client PC with the text sent from within the page. An excerpt of it is shown below: With Response .ContentType = "application/vnd.ms-excel" .Write(strResponse) .Flush .End End With
by: zweng | last post by:
I checked a few sites on exporting data from asp.net to excel and most of them point to the same source a http://support.microsoft.com/default.aspx?scid=kb;EN-US;317719 with some modifications My code is in the block below. When I click save when the open/save message box pops up, the file is saved as the aspx page's name with .xls. However, when I open the file, the filename is the exact aspx page name with .aspx in MS Excel ...
by: ad | last post by:
I use the code below to export the content of a data set to Excel, the code come form http://www.dotnetjohn.com/articles.aspx?articleid=36 But it always use the web form's name as the default name of excel. Can we specify a meaningful filename before exporting to EXCEL? ------------------------------------------------------------------------------------------- 'first let's clean up the response.object response.Clear()
by: Costas Andriotis | last post by:
This is rather a IE-specific problem, but maybe someone has a solution. The HTTP headers are correct (Gecko for example understands and downloads/saves the file correctly) but IE does the wrong thing depending on the code: sf = "Non-ASCII but valid filename.extension" Response.AppendHeader("Content-Disposition", "attachment; filename=""" & sf & """") proposes and saves under a UTF-8-encoded filename. ...
by: Henke | last post by:
I have a web application that is used to transfer files to and from a database. The files are streamed and stored in the database that is. From one page I can download the files to the client, by clicking on the filename. The confirm download popup (the one built-in in IE) is displayed and I can select either Save or Open. One the file name row the name of the file is displayed but all " " (spaces) are replaced with a "+"-sign. Does...
by: Jed | last post by:
I have looked everywhere and cannot find a resolution for this. I have read several post on this forum that allude to similar issues but I have not found a solution. I am sending dynamic content to the browser to be opened in Excel. On some browsers including on the mac it works fine, but in other browsers it sets the filename to the script instead of to the name specified in the content-disposition. I am at my wits end. Here is a...
by: AC [MVP MCMS] | last post by:
I've got an page used for downloads that acts similarily to the MSFT downloads.... page displays and refreshes itself which causes a XML file to be streamed to the client. The streaming of the file is working fine, however, IE is mucking the the filename I specify. For example, I'm specifying the filename "Product.License.lic", but IE displays "Product.License.lic". See code below... ideas? Response.ContentType = "text/xml";
by: Arthur Dent | last post by:
Hello All... I am in an app that needs to write out an XML document for transmittal to an outside organization. All good and fine... I create the XmlDocument object, append all my nodes, and values etc etc... and it all works. Now I go to save the file... I tried two methods... MyXmlDocument.Save(filename) and My.Computer.FileSystem.WriteAllText(filename, MyXmlDoc.OuterXml, False)
by: Nick | last post by:
Hey there, I'm trying to get a textbox (using ASP.NET / VB.NET) to display XML without freaking out the browser afterwards. Currently I have the textbox displaying the XML fine, but that's when things go funny, the second another postback occurs it complains. I thought that a textbox would have it's contents escaped in on way or another, obviously not, any idea how I can get the page to ignore it's contents? I don't want it to use...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.