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


1 answer


What do you look like in the XSL doc output? What encoding are you setting there?



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

      

0


a source







All Articles