Jump to content
We have recently updated our Privacy Statement, available here ×
  • BW6.X - BWCE - How to decode / encode a string in binary format in BusinessWorks and BusinessWorks Container Edition

    Some integration scénarios requires to decode strings received in binary format or in the other way to encode strings in binary format.

    This article goal is to explain how to do this in BusinessWorks and BusinessWorks Container Edition.

    Decoding a string

    In such scénario BusinessWorks receives a byte string that contains an encoded character string, for example in UTF-8, and there is need to handle the character string as a String in BusinessWorks.

    In BusinessWorks a byte string is handled as a field of type Binary and internally managed as a base64 string.

    So what we need to do is simply to decode the base64 string with the encoding used by the sender application when creating the received byte string.

    This can be done using the following XPATH formula (if the source encoding is UTF-8):

    tib:base64-to-string(xsd:string($FilePoller/fileContent/binaryContent), “UTF8”)

    Note that internally BusinessWorks is using Unicode (UTF-16 encoding) to manage Strings.


    Encoding a string

    In such scénario BusinessWorks transforms a String in a byte string using a given encoding.

    In this case what we need to do is simply to encode the String in a base64 string with the needed encoding.

    This can be done using the following XPATH formula (in this example the target encoding is IBM297):

    xsd:base64Binary(tib:string-to-base64($Mapper/primitive, “IBM297”))


    Useful elements

    The available encodings are the one supported by Java, the list is available here:


    You can find more details on encoding in the following blog article from my colleague René Kiessling:


    Additional elements

    You can refer to the attached project.


    User Feedback

    Recommended Comments

    There are no comments to display.

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Create New...