Wednesday, March 28, 2012

Strange characters displayed in file name - File Download Dialog - IE

I don't know what else to try - In my asp.net app, when the file name has
Windows-1252 characters (like and ), these characters appear, each one,
as two strange characters in the file name label in Internet Explorer File
Download Dialog that is shown when I click a link to download the file. The
file content is being generated on-the-fly using asp.net and the filename is
being passed using a call to Response.AddHeader with the strings
"Content-Disposition" and "attachment; filename=" + filename.

I want the file name to display correctly, as it DOES when I click a link in
a test HTML file that points to a "real" file stored in the system.

I tried setting Response.ContentEncoding but all my atempts were
unsuccessful.
I have also searched the net, specially google groups for an answer but I
couldn't find.

Thank you in advance,

Daniel CardosoAfer trying a little bit more, I decided to analyze the HTTP response
generated by the server in response to a request to download the file. I
then realized that the special characters were being wrongly represented and
sent to the client. I had to use Server.UrlEncode to encode the file name
appropriately, in addition to setting Response.ContentEncoding, so that the
special symbols were correctly sent to the browser. The problem is now
solved.

Regards,

Daniel Cardoso

"Daniel Cardoso" <someone@.nospam.com> wrote in message
news:uMYy4yXoEHA.2636@.TK2MSFTNGP09.phx.gbl...
> I don't know what else to try - In my asp.net app, when the file name has
> Windows-1252 characters (like and ), these characters appear, each one,
> as two strange characters in the file name label in Internet Explorer File
> Download Dialog that is shown when I click a link to download the file.
The
> file content is being generated on-the-fly using asp.net and the filename
is
> being passed using a call to Response.AddHeader with the strings
> "Content-Disposition" and "attachment; filename=" + filename.
> I want the file name to display correctly, as it DOES when I click a link
in
> a test HTML file that points to a "real" file stored in the system.
> I tried setting Response.ContentEncoding but all my atempts were
> unsuccessful.
> I have also searched the net, specially google groups for an answer but I
> couldn't find.
> Thank you in advance,
> Daniel Cardoso

0 comments:

Post a Comment