webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  XSLT mapping issue with UTF-8 encoding

    Posted Tue December 28, 2010 12:39 PM

    Hi all,
    I am working with an XSLT mapping and am facing an error as:
    SAXParseException: Invalid byte 2 of 2-byte UTF-8 sequence

    I am passing an xml with tag as <?xml version="1.0" encoding="UTF-8"?>
    Is their any way that we can actually confirm if the xml complies to UTF-8 encoding?

    Can anybody please tell me as to how to avoid this error?

    Thanks in advance.

    Regards,
    Krithiga M


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: XSLT mapping issue with UTF-8 encoding

    Posted Tue December 28, 2010 02:13 PM

    hi, when you convert document to XML string (or where ever you make the XML string) make sure that you set encoding to UTF-8 explicitly, otherwise the encoding will be of the JVM default. If you receive the XML from external system then try convert to document and then to XML string with encoding as UTF-8.
    I think the issue is due to the xml is ISO or Windows encoding and XSLT parser considers as UTF-8.

    • hope this helps
      DC

    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: XSLT mapping issue with UTF-8 encoding

    Posted Tue December 28, 2010 02:47 PM

    Hi DC,
    Thanks for your reply.
    Actually am getting a response from a webservice. It is a document already.
    As you suggested, i have again done the encoding explicitly as follows just in case it helps

    doc to string
    string to node → specified encoding as UTF-8
    node to doc
    doc to string

    Not sure if we can do a round about like this, but at least thought if this could solve the problem.

    but even then am getting the same error:(

    Regards,
    Krithiga Muralidharan


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 4.  RE: XSLT mapping issue with UTF-8 encoding

    Posted Tue December 28, 2010 03:57 PM

    you need to know the original encoding of the content that you received from you WS call. (you may find with the WS provider)
    once you get it, after convert it to a string, use the java.nio.charset.CharsetDecoder and CharsetEncoder to do the conversion (google on sample of usage)


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods