views:

306

answers:

1

I am trying to create an html attachment by processing some of my xml through an xsl transform and sending it to the client. If I click "open", IE shows the html properly, but if I save the attachment and then open it in Firefox, every place there was a   I'm getting a "Â" character. I have a feeling this has 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 a stringwriter.tostring() that contains the transformed html.

It seems that the xslt always sets the encoding at UTF-16, but I've changed the code above to utf-16 and it doesn't work either. Any ideas what's going on?

Thanks.

A: 

What does you XSL doc output look like? What encoding are you setting there?

<xsl:output encoding="utf-8"  omit-xml-declaration="yes" method="html" indent="no" ></xsl:output>
BigBlondeViking