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

Encode a string from UTF-8 to ANSI(without changing special characters in string)

  • 1.  Encode a string from UTF-8 to ANSI(without changing special characters in string)

    Posted Wed November 04, 2015 06:40 AM

    HI,
    Can someone please explain how to encode a string from UTF-8 to ANSI without effecting or missing the special characters in the string.

    Thanks in advance


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods


  • 2.  RE: Encode a string from UTF-8 to ANSI(without changing special characters in string)

    Posted Wed November 04, 2015 07:00 AM

    Hi – There is no such built-in service to transform till wm8 Version, so you should go for writing java service. Not sure if any built-in service in 9.8 or 9.9 versions.

    Thanks,


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 3.  RE: Encode a string from UTF-8 to ANSI(without changing special characters in string)

    Posted Wed November 04, 2015 04:41 PM

    In a Java environment, a String is always encoded in UTF-16. You care about encoding only when you need to convert from/to bytes.

    you can use:
    pub.string:stringToBytes
    pub.string:bytesToString
    and specify the encoding of the Bytes. It’s supported since beginning of WM, all versions.

    BTW, if you mean ASCII, it doesn’t support many special characters, if you are converting from UTF-8 bytes, you may end up with ??? in places of special characters.


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General