[ https://issues.apache.org/jira/browse/CAMEL-21505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17908291#comment-17908291 ]
Claus Ibsen commented on CAMEL-21505: ------------------------------------- [~jono] I wonder if you would have time to look into this. As it looks like that a US-ASCII Charset is selected by default. I wonder if there is a way to understand from the received AS2 message whether its binary or not. I assume there is a header indicating binary vs plain text > camel-as2: Binary files get corrupt when using 'base64' content transfer > encoding > --------------------------------------------------------------------------------- > > Key: CAMEL-21505 > URL: https://issues.apache.org/jira/browse/CAMEL-21505 > Project: Camel > Issue Type: Bug > Components: camel-as2 > Affects Versions: 4.8.1 > Environment: Windows and Docker > Java 21 Temurin > Reporter: Meinolf S-D > Priority: Minor > Fix For: 4.8.3, 4.10.0 > > Attachments: image-2024-12-03-12-29-47-487.png > > > Binary files get corrupt when using *base64* content transfer encoding due to > String assignment of the decoded byte[] > This can easily be tested sending a .zip file to Camel AS2 listener. > After some investigation the issue seems to be in the EntityUtil.decode > method. > As shown in the screenshot the decoded (binary) byte[] is assigned to a new > String which result into corrupt date in case of binary content. > !image-2024-12-03-12-29-47-487.png! > In addition there are new line characters in the encoded base64 encoded > String data object. > In case of using transfer encoding type *binary* > java.nio.charset.MalformedInputException: Input length = 1 it thrown which > might be OK. -- This message was sent by Atlassian Jira (v8.20.10#820010)