Streaming files and character sets
I made some code that exports some of the details of a magazine article to a link manager called Endnote
The format of which is a list of elements as shown below (author):
%A Schortgen Frรฉdรฉrique
Unfortunately I have some encoding issues somewhere, since when endnote opens the file, this is what it does from the aforementioned author:
Schortge Frร ยฉ dique
I was madly trying to play around with the encoding and the things I was outputting and I am at a loss, here is the code:
Response.ContentType = _citation.ContentType;
string fileExtension = "";
if (_citation.GetFileExtension() != null)
fileExtension = "." + _citation.GetFileExtension();
Response.AddHeader("content-disposition", "attachment; filename=citation" + fileExtension);
Response.ContentType = _citation.GetFileReferrer();
Response.Charset = "UTF-8";
Response.write(-snip-);
Response.End();
source to share
It looks like Endnote is not expecting UTF-8. Do you have details of what the Endnote is in for? You may find that using Encoding.GetEncoding (1252) or Encoding.GetEncoding (28591) (which are Western encoding 1252 and ISO-8859-1 respectively) might work.
Btw, you are setting Response.ContentType twice. This sounds unlikely.
source to share