IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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
Expand all | Collapse all

ASCII encode

  • 1.  ASCII encode

    Posted Mon November 22, 2010 10:04 AM

    Hi,

    i have a requirement for ASCII encoding the data with special characters (for eg. <,> etc) in a document to string.Can anyone suggest a solution.


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


  • 2.  RE: ASCII encode

    Posted Mon November 22, 2010 12:05 PM

    Hello,
    It might not be very useful suggestion, but check out the services of pub.report…

    Regards.


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


  • 3.  RE: ASCII encode

    Posted Mon November 22, 2010 02:07 PM

    Hi ,

    I have referred services in pub.report package but could not find any clue.I will elaborate my query.

    i have a document containing xml data which has certain special characters like <.>,& etc… i need these special characters to be ascii coded.For example < should be converted to < and so on. If you have any idea on this please help.

    Thanks,
    Sireesha.A


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


  • 4.  RE: ASCII encode

    Posted Mon November 22, 2010 02:24 PM

    Hello,
    Buddy, XML doc contains those characters…
    But why you want to ascii code them, they will come as it is, wherever you use…


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


  • 5.  RE: ASCII encode

    Posted Mon November 22, 2010 02:38 PM

    requirement is to ascii encode those characters and send to partner.


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


  • 6.  RE: ASCII encode

    Posted Mon November 22, 2010 02:42 PM

    Are you using TN for this, and is the requirement specific…
    If no, then there is no need for it, you can directly use routeXML…
    If yes, then I have not come across still…but still I have doubt…
    It you solve this problem, do write back…please…
    Regards


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


  • 7.  RE: ASCII encode

    Posted Mon November 22, 2010 04:51 PM

    What you are referring to is HTML or XML encoding, not ASCII encoding.

    This “encoding” is used so that characters with specific meaning to the HTML/XML parser can distinguish between data and reserved characters used in markup.

    “Encoding” entails converting the reserved characters that appear within the data to what are called “character entities”. For example, < is converted to <

    Within your FLOW service the typical approach to performing this encoding is to set the “encode” input parameter to true when calling pub.xml:documentToXMLString. This will perform encoding on all fields of the document. Side note: IMO, the default for this input is false but should be true. Callers should always set this to true unless there is a specific reason not to.

    Another service that is available is pub.string:HTMLEncode. This can be useful in some scenarios when documentToXMLString is not used.

    HTH


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


  • 8.  RE: ASCII encode

    Posted Tue November 23, 2010 11:10 AM

    Hi Rob,

    Thanks for your reply.
    I understood that to convert < to < using pub.xml:documentToXMLString service i need to set encode as true i.e HTML encoding.

    Instead of HTML encoding , is there any way to ASCII encode the data?If yes, please let me know how to achieve that.

    Thanks,
    Sireesha.A


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


  • 9.  RE: ASCII encode

    Posted Tue November 23, 2010 03:02 PM

    hi Sireesha,
    Use “pub.string:stringToBytes” and set encoding = “ascii”.
    alternatively you should consider using UTF-8 encoding as this is backward compatible with ASCII and can encode wide range of international characters as well.

    Can you tell us why you need to ASCII encode?

    -regards
    DC


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


  • 10.  RE: ASCII encode

    Posted Tue November 23, 2010 05:04 PM

    “Instead of HTML encoding , is there any way to ASCII encode the data”

    These are 2 completely different aspects. If you’re creating XML, you must HTML encode the contents of the XML elements. Using the ASCII charset is not an alternative approach. Characters such as <, >, & are within the ASCII charset–they must be converted to character entities.

    I suspect you don’t really need to use ASCII–you should probably use ISO-8859-1. And if you do so, you should set the XML header properly to indicate the charset being used.

    As DC asks, what’s driving the desire to use US-ASCII charset?


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