0

In IE 8 when I download a document which I've coded in C#/xslt/xml the title of the document should be '£sqft' but it's '£sqft'.

I kind of guess the reason - its because the string is encoded in .NET in utf-16 and IE 8 uses ansi to read it. I'm guessing this because using notepad++ if I enter £ in utf-8 then switch to ANSI it preceeds the character with this other character.

How do I get IE 8 to read it as utf-8?

Here is the code for creating the document where I'm passing an xsl file the name of which is '£sqft' which exports as '£sqft':

        TextWriter output;       
        DataSet ds = 'some dataset'
        XmlDocument xDoc = new XmlDocument(); 
        xDoc.LoadXml(ds.GetXml());
        xt.Load("c:/£sqft.xsl");    
        xt.Tran

sform(xDoc, null, output);

insanepaul
  • 187
  • 2
  • 5
  • 17
  • What are you setting the content-type to in the header when you send it to the browser? – Jon Hanna Jan 22 '14 at 12:25
  • I was thinking about that...It's Response.AppendHeader("Content-Disposition", "attachment;filename="+ sXslFile) – insanepaul Jan 22 '14 at 12:54
  • Oh, you're actually saving it as a file? Do you have a `` declaration at the top of the file? You shouldn't need one (UTF-8 should be assumed as a default), but it might be worth trying. – Jon Hanna Jan 22 '14 at 13:03
  • Hi, yes its at the top of the file...however its the title of the file that messes up not the contents of the file. – insanepaul Jan 22 '14 at 13:08
  • The response header is: Response.AppendHeader("Content-Disposition", "attachment;filename="+ "£sqft.doc" I've tried Response.Write('\uFEFF'); Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble()); – insanepaul Jan 22 '14 at 13:18
  • possible duplicate of [iconv: Converting from Windows ANSI to UTF-8 with BOM](http://stackoverflow.com/questions/4364156/iconv-converting-from-windows-ansi-to-utf-8-with-bom) – Paul Sweatte Oct 07 '14 at 01:37

0 Answers0