views:

195

answers:

2

I have made some code which exports some details of a journal article to a reference manager called Endnote

The format of which is a list of items like below (an author):

%A Schortgen Frédérique

Unfortunately, I am having some encoding problems somewhere, as when endnote opens the file, this is what it makes of the above author:

Schortge Frédérique

I have frantically tried playing around with the encoding and stuff that I am 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();
+1  A: 

It looks like Endnote isn't expecting UTF-8. Do you have details of what Endnote does expect? You may find that using Encoding.GetEncoding(1252) or Encoding.GetEncoding(28591) (which are Western codepage 1252 and ISO-8859-1 respectively) might work.

Btw, you're setting Response.ContentType twice. That sounds unlikely to be a good thing.

Jon Skeet
There seems to be very little documentation that I can find on producing EndNote files (much to my annoyance). But from what I can gather it does support UTF-8.Good spot on the repeat, i have fixed that. Didnt sort my original problem though :p
qui
Can you *create* a file with that name in Endnote and see what it looks like (using a hex editor)?
Jon Skeet
A: 
Response.Charset = "ISO-8859-1";            
Response.ContentEncoding = System.Text.Encoding.GetEncoding(28591);
Response.HeaderEncoding = System.Text.Encoding.GetEncoding(28591);

You Sir, are a legend (once again)

qui