473,671 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting filename including non ascii characters in asp download!

Hi!

I have a classic ASP site (not ASP.NET) where the user is able to download
documents. The documents are stored inside an Oracle database set up for
UTF-8 encoding. In the VB6 code (COM+) that fetches the document I have code
like this (in my asp page I have set codepage=65001 which is utf-8)

GetObjectContex t("Response").A ddHeader "Content-Length",
rs("DocData").A ctualSize
GetObjectContex t("Response").c ontentType = "applicatio n/octet-stream"
GetObjectContex t("Response").A ddHeader "Content-Disposition", "attachment ;
filename=""" & rs("orgfilename ") & """"
GetObjectContex t("Response").B inaryWrite
rs("DocData").G etChunk(rs("Doc Data").ActualSi ze)
The problem is that if the filename contains national characters they are
not shown correct in the save as dialog. I have tried to understand the RFC
documents about content-transfere-encoding but I have so far failed making
this work.

I can get this to work in IE if I URLPathEncode the filename (normal
urlencode is not working)
GetObjectContex t("Response").A ddHeader "Content-Disposition", "attachment ;
filename=""" & GetObjectContex t("Server").URL PathEncode(rs(" orgfilename")) &
""";"

Mozilla compatible browsers do not like this. They suggest the the filename
dok.asp, which is the name of the asp file that instantiate the com+
component that do the actual download.

Would really appreciate if someone can shed some light over this (an example
would be excellent).

Sorry to crosspost this message but I'm not sure if my problems is in my
code, IIS or maybe incorrect headers.

Regards
/Hans
Jul 22 '05 #1
4 3191
"Hans" <ha***@sorry.no spam.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi!

I have a classic ASP site (not ASP.NET) where the user is able to download

Would really appreciate if someone can shed some light over this (an
example
would be excellent).
This is really nasty since none of the browsers really follow the rules
http://support.microsoft.com/?id=267991
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

Sorry to crosspost this message but I'm not sure if my problems is in my
code, IIS or maybe incorrect headers.

Regards
/Hans


Jul 22 '05 #2
Hi Egbert and thanks for your reply!

My problem is not really that the save as dialog is not shown (in fact it is
shown). The main problem is that the filename I set in the content
disposition (including non ascii characters) is not shown in the save as
dialog. I can get this to work on my machine with IE but it fails with
Mozilla browsers (and I have read that the solution I have for IE that works
on my machine is not working on asian versions of IE
http://lists.w3.org/Archives/Public/...Mar/0000.html).

I tried to read the rfc2231 but I cannot get it to work.
http://www.faqs.org/rfcs/rfc2231.html

Regards
/Hans
Jul 22 '05 #3
"Hans" <ha***@sorry.no spam.com> wrote in message
news:%2******** **********@TK2M SFTNGP14.phx.gb l...
Hi Egbert and thanks for your reply!

My problem is not really that the save as dialog is not shown (in fact it
is
shown). The main problem is that the filename I set in the content
Right. I know what you mean.
disposition (including non ascii characters) is not shown in the save as
dialog. I can get this to work on my machine with IE but it fails with
Mozilla browsers (and I have read that the solution I have for IE that
works
on my machine is not working on asian versions of IE
http://lists.w3.org/Archives/Public/...Mar/0000.html).

I tried to read the rfc2231 but I cannot get it to work.
http://www.faqs.org/rfcs/rfc2231.html

Sorry but, browsers don't follow the rules. The only solution would be to
have an ISAPI sort of solution which generates the filename inside the url
instead of using a content-type solution, but that's an expensive joke.
(such filter would fake a filename using
http://www.yourserver.com/yourfile%20blah.doc or something like that.)

Regards
/Hans


Jul 22 '05 #4
Hello,

Good news: The solution to your problem exists !

Bad news: I can not provide you with working ASP code.

I ran into the very same problem just a few days ago when coding the
download fastcgi of our site. I have found the proper encoding for
Internet Explorer (only tested on Version 6 / WinXP so far) and for
Firefox (again only tested on WinXP yet).

For IE, I think you will find this page useful:

http://www.codeproject.com/aspnet/NonUSASCII.asp

I reproduced the filename encoding and its works great (all our code is
using the Ruby language).

This DOES NOT WORK for Firefox, so I test the HTTP_USER_AGENT value and
use the word encoding described in RFC2231. I use the Base64 encoding,
not the Quoted-printable which does not work.

For these two browsers everything is perfect, I tested it with really
weird (from my point of view of course ;) ) filenames mixing french,
icelandic and korean.

As far as Opera is concerned, I have yet to find the correct way to
encode the file name. I can not imagine it is not possible, but I am
stuck on this browser. :(

Hope you find this helpful, feel free to contact me if you do not get it
working. I do not follow this newsgroup.

Katarina.

*** Sent via Developersdex http://www.developersdex.com ***
Jul 22 '05 #5

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

Similar topics

2
1777
by: Bartolomé Sintes Marco | last post by:
Hi, I have downloaded and installed Python 2.3 RC1 in a Windows 98 SE computer. IDLE 1.0 does not work very well: a) When I open with IDLE 1.0 RC1 a program written with IDLE 0.8, non-ASCII characters (like voyels with accents) are changed to wrong characters. b) If a program has non-ASCII characters, save or save as work when a new file is created, but if I open a file with non-ASCII characters and I modify it, then I can not save it...
11
4352
by: Marian Aldenhövel | last post by:
Hi, I am very new to Python and have run into the following problem. If I do something like dir = os.listdir(somepath) for d in dir: print d The program fails for filenames that contain non-ascii characters.
0
1984
by: Hans | last post by:
I have an asp site which I try to bet unicode compatible (UTF-8 codepage=65001). In the site a user can upload documents and I store the document on the server in a database. I also store the original filename. If this filename contains for example swedish characters like å,ä ö which are outside ascii 0-127 i get problems when I try to download the file from server-->client. In my com+ packages (which are instantiated from asp files) I...
4
3843
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII characters"(No. 128 to 255) . e.g., in one version No. 224 is the symbol alpha, in another, it's a "a" with a ` on it... How come? You can see it here: http://www.kturby.com/cables/ascii2.htm
3
24502
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine for decrypting the file works fine however when I encrypt the file, several characters are corrupted. when I looked into it they are always extended ascii characters (eg "x" which is ascii character 120 gets translated to ascii character 130 which...
0
3208
by: Nickneem | last post by:
I'm having trouble getting the output of a (MS SQL server) query in html: ± is displayed as &# 177 ; and -» as - &# 187 ; not to mention the acute accent (é) and other diacritic characters. I guess there's a problem with displaying the extended ascii characters in Internet Explorer, some applications seem to have no problem with it but if I create an asp.net app or a crystal report I get these strange
12
9119
by: bg_ie | last post by:
Hi, I'm updating my program to Python 2.5, but I keep running into encoding problems. I have no ecodings defined at the start of any of my scripts. What I'd like to do is scan a directory and list all the files in it that contain a non ascii character. How would I go about doing this? Thanks,
3
4840
by: Benjamin Hell | last post by:
Hi! I have a problem with the cx_Oracle module (Oracle database access): On a computer with cx_Oracle version 4.1 (Python 2.4.3, Oracle 10g) I can get query results consisting of strings including non-ASCII characters, e.g. the code example below outputs "é 0xe9" (which is the correct ISO-8859-1 hex code for "é"). On a newer installation with cx_Oracle 4.3.3 (Python 2.5.1, connecting to the same Oracle 10g server) these characters are...
7
3975
by: Laszlo Nagy | last post by:
Peter Bulychev wrote: Please be more specific. There is no general solution. Unicode can handle latin, cyrilic (russian), chinese, japanese and arabic characters in the same string. There are thousands of possible non-ascii characters and many of them are not similar to any ascii character. If you only want this to work for a subset, please define that subset. Laszlo
0
8476
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8914
Oralloy
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...
0
8820
jinu1996
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...
1
8598
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,...
0
8670
tracyyun
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...
0
5695
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();...
0
4406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2810
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.