Create html attachment from xslt, encoding issues, asp.net
I am trying to create an html attachment by processing part of my xml with an xsl transform and sending it to the client. If I click "open" IE displays the html correctly, but if I save the attachment and then open it in Firefox, then I get a "Â" character in every place. I have a feeling it has something to do with our encoding. Here's the relevant code:
Response.Clear();
Response.ContentEncoding = Encoding.UTF8;
Response.ContentType = "text/html";
Response.Charset = "utf-8";
Response.AddHeader("Content-Disposition",
String.Format("attachment; filename={0}; size={1}", filename, rgen.Output.Length));
//Response.Flush();
Response.Write(rgen.Output);
Response.Flush();
Response.End();
rgen.Output is a string that comes from stringwriter.tostring () that contains the converted html.
It seems like xslt always sets the encoding to UTF-16, but I changed the code above to utf-16 and it doesn't work either. Any ideas what's going on?
Thanks.
0
a source to share