473,395 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Unicode Headers for Filedownload

Hi,

maybe someone had the same problem:
http://support.microsoft.com/kb/895262/en-us

This Hotfix is only available for Windows 2003, but we also use Windows
2000 and for development Windows XP. So I thought ASP.NET 2.0 will make
things better.

And now ASP.NET is there and I found this:
http://msdn2.microsoft.com/en-us/lib...rencoding.aspx

But if I set the Encoding to Unicode, I get this:
'utf-16' cannot be used as Header Encoding

Here is a little testing app:
string filename = "abcdeäüö.txt";

System.Text.UnicodeEncoding enc = new
System.Text.UnicodeEncoding();

Response.ContentType = "text/plain";
Response.Clear();
byte[] buffer ={ 65 };
Response.HeaderEncoding = enc;
Response.AddHeader("Content-Disposition",
"attachment;filename=" + filename);
Response.BinaryWrite(buffer);
Response.Flush();
Response.End();

Is it a bug or a feature? ;-)

thx in advance
Bjoern Wolfgardt

Nov 19 '05 #1
1 1967
WO70 wrote:
Hi,

maybe someone had the same problem:
http://support.microsoft.com/kb/895262/en-us

This Hotfix is only available for Windows 2003, but we also use
Windows 2000 and for development Windows XP. So I thought ASP.NET 2.0
will make things better.

And now ASP.NET is there and I found this:
http://msdn2.microsoft.com/en-us/lib...response.heade
rencoding.aspx

But if I set the Encoding to Unicode, I get this:
'utf-16' cannot be used as Header Encoding

Here is a little testing app:
string filename = "abcdeäüö.txt";

System.Text.UnicodeEncoding enc = new
System.Text.UnicodeEncoding();

Response.ContentType = "text/plain";
Response.Clear();
byte[] buffer ={ 65 };
Response.HeaderEncoding = enc;
Response.AddHeader("Content-Disposition",
"attachment;filename=" + filename);
Response.BinaryWrite(buffer);
Response.Flush();
Response.End();

Is it a bug or a feature? ;-)


It's a bug. HeaderEncoding doesn't work at all -- well, the
undocumented exception in case you try to use UTF-16 is being thrown,
but sadly that's it.

This is a IE bug as well -- Firefox has no problems decoding the UTF-8
encoded header.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #2

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

Similar topics

8
by: Bill Eldridge | last post by:
I'm trying to grab a document off the Web and toss it into a MySQL database, but I keep running into the various encoding problems with Unicode (that aren't a problem for me with GB2312, BIG 5,...
0
by: DenoxiS | last post by:
Hi, I've been working on a project that will help me save some time. It basically reads a URL and saves it to disk as an html file. In other words, I just wanted to make the automated version of...
0
by: Jim | last post by:
Reading http://msdn.microsoft.com/workshop/browser/webbrowser/reference/events/filedownload.asp, it seems that the FIleDownload event occurs before showing a File download dialog box. In this...
1
by: Marc Gravell | last post by:
I'm trying to hook some simple monitoring functions into an existing WebBrowser instance on a form... I was hoping to track individual file downloads, so I looked at the FileDownload event....
8
by: Andy | last post by:
Hello All: I have a windows application that I need to encode a string using Unicode. The example I have been given to use is a Web-Version. Below is the webcode. ...
0
by: prefect | last post by:
I am trying to make a file download functionality similiar to the downloads at www.microsoft.com/downloads/ I have a FileDownload.aspx page. when user clicks download button , i open a popup and...
3
by: pratik.best | last post by:
Hi, I just seen the web site of the unicode committee and was amazed to see the site showing document in Hindi without using any such fonts like "Kruti Dev" or "Dev Lys". "Webdunia.com" is also...
4
by: =?Utf-8?B?Q29tcHV0ZXJXZWVuaWU=?= | last post by:
Hello, I'm not sure if this is the right forum to post this question, but I cannot find a more relevant forum. I am using Visual Web Developer and using the FileUpload Control to upload files...
5
by: Thierry | last post by:
Hello fellow pythonists, I'm a relatively new python developer, and I try to adjust my understanding about "how things works" to python, but I have hit a block, that I cannot understand. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
agi2029
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,...

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.