IBM Support

Using the BASE64TOTEXT function with JSON data there are '\r\n' in the output

Troubleshooting


Problem

Using the BASE64TOTEXT function with JSON data there are '\r\n' in the output.

Symptom

Using the BASE64TOTEXT function with JSON data there are '\r\n' in the output, which is not expected.

Cause

The TEXTTOBASE64 function receives a text object and uses the MIME implementation to convert the text to Base64 format.
The MIME implementation adds the <CR><LF> character sequence after every 76 bytes and also at the end of the output string. A CRLF is added to the data every 76 bytes.
<CR><LF> are JSON escape characters and they get converted to /r for CR and /n for LF.

Environment

Running an IBM Transformation Extender (ITX) Map that uses TEXTTOBASE64 function with JSON data.

Diagnosing The Problem

Running an ITX Map that uses TEXTTOBASE64 function with JSON data there are '\r\n' in the output instead of the expected <CR><LF>.

Resolving The Problem

A workaround is to use the SUBSTITUTE function to remove the <CR><LF> from the BASE64 data before it is moved to the JSON document.

Document Location

Worldwide

[{"Line of Business":{"code":"LOB59","label":"Sustainability Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSVSD8","label":"IBM Transformation Extender"},"ARM Category":[{"code":"a8m50000000L2p8AAC","label":"Core Engine"}],"ARM Case Number":"TS004280185","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Document Information

Modified date:
03 December 2020

UID

ibm16343207