Skip to Content

Co-Author: Rajwinder Singh


Problem Statement – Encoder – Base64: Conversion results in Line Feed character at every 76th position


Example Process Flow to simulate the behavior:



1)     Following screenshot shows the Payload introduced via the first Content Modifier.



The payload consists of continuous text without any Line Feed.


2)     The following screenshot shows the Encoder settings to converts the text to Base64 format.



3)   After deploying the integration flow, the resultant text contains Base64 encoded output. However, there is also an additional line feed character present at every 76th position.



The reason for this behavior (as also highlighted in the WIKI pages below) is an old MIME format. Please refer the wiki page for more details.




Solution / Alternative:

Use groovy function encodeBase64() to convert to Base 64 which uses a more recent format and does not introduces a line feed character at every 76 position.



Output after Base64 conversion using groovy.



Sample Groovy:


import java.util.HashMap;


def Message processData(Message message) {



def body = message.getBody(String.class);


String encoded = body.bytes.encodeBase64().toString();



return message;



Please note: The purpose of the Blog is to share an alternative approach to the issue and does not suggest it as the only available alternative.


To report this post you need to login first.


You must be Logged on to comment or reply to a post.

    1. Ritesh Kumar Kumaria Post author

      Hello Dheeraj,

      You could use the standard Decoder which should work fine, though I haven’t tried it on this example. Alternatively method decodeBase64() could be used.




Leave a Reply