Transformed XML & controlling encoding type

Home Page Forums BizTalk 2004 – BizTalk 2010 Transformed XML & controlling encoding type

Viewing 1 reply thread
  • Author
    Posts
    • #12326

      Hi,

      I am trying to transform input xml to output using XSLT. I use xsltranform class to do that. Although, both my input xml & xsl (using xsl:output encoding=\”utf-8\” statement) state utf-8, I always get utf-16 encoded output document.

      Is there a way to change that?

      My original code was:
      StringBuilder sb = new StringBuilder();
      TextWriter tw = new StringWriter(sb);

      XslTransform xsl = new XslTransform();
      xsl.Load(xslFile);
      xsl.Transform(doc, null, tw, null);
      XmlDocument ret = new XmlDocument();
      ret.LoadXml(sb.ToString());
      return ret;

      which I later changed to use memorystream, as per the suggestion posted elsewhere on the web:

      MemoryStream ms = new MemoryStream();
      xslt.Transform(xDoc, null, ms);
      ms.Position = 0;
      StreamReader sr = new StreamReader(ms, Encoding.UTF8);
      transformedXml = sr.ReadToEnd();

      This still does not work…

      Any suggestions?

      Thanks

    • #12327

      No Stephen. I am not using BizTalk mapper per se… Instead, an expression that calls .Net component to do this…

      (Within a BizTalk mapping screen, there is an option to select the encoding, that I am aware of… thanks)

      Thanks…

      • #12328

        Are you using a BizTalk map for your transformation?

        If not, I don’t think I can help you out much.

        I did have somewhat of a similar probably with encoding but I think I corrected it by using a text string rather then the byte sting I was using. Probably not too relevant to what you are doing.

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.