Skip to Content
author's profile photo Former Member
Former Member

how to read email attachment encoding

Hi there,

I have a requirement in which I need to read the email attachment which I am able to but inside the attachment I have couple of German characters which is not displaying correctly because of encoding.

I am using UDF to read the email Content and when I check the ABAP stack it is showing

MailMessage (text/xml;charset = utf-8)

MailAttachment-1 (application/octet-stream;name="abcdedg"

XML file which is coming as an attachment contains this

<STRAS>Eisenhüttenstr. 99</STRAS>

But after when the file comes to PI it will become

<STRAS>Eisenhüttenstr. 99</STRAS>

I have tried all the Content Encoding in Sender Mail adapter but nothing works.

Can anybody please tell me how to solve this problem.

Thanks,

Iqbal

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on May 24, 2012 at 12:10 PM

    Hi Iqbal,

    The Attachment Java class that you are most probably using in the UDF to read the attachment content contains a method getContentType() that will help you determine the charset used. You could also read the charset from the attachment payload, as it should be starting with:

    <?xml version="1.0" encoding="SOME_ENCODING"/?>

    Then you can generate the UDF output with:

    String output = new String(attachment.getBytes("ISO-8859-1"), "UTF-8");

    return output;

    Where attachment is some string variable containing the attachment payload.

    Regards,

    Greg

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.