cancel
Showing results for 
Search instead for 
Did you mean: 

Task Gateway - UTF-8 encoded text attachment with inline display

gabmarian
Active Contributor
0 Kudos

We have a workflow task integrated into My Inbox, to which prior to the approval step attachments are uploaded in SBWP, either in RAW or TXT format and with UTF-8 encoding.

To be able to make a decision, approvers open these attachments from My Inbox.

Problem is, that on mobile and tablet - where the approval is mostly used - the browser open these attachment files inline and non-ASCII characters are displayed inproperly.

I've noticed that the HTTP response returning the file contains the following header:

Content-Type: text/plain

which if being extended with the charset=UTF-8 addition the problem is solved.

Currently I use an implicit enhancement at the end of method /IWPGW/CL_TGW_TASK_FACADE_BWF~/IWPGW/IF_TGW_TASK_FACADE~READ_TASK_ATTACHMENT_STREAM with the following coding:

    DATA encoding LIKE cl_abap_file_utilities=>encoding_utf8.

    IF substring_before( val = es_attachment_stream-mime_type sub = '/' ) = 'text'.

      cl_abap_file_utilities=>check_xstring_utf8(
        EXPORTING
          xstring  = es_attachment_stream-value
        IMPORTING
          encoding = encoding ).

      IF encoding = cl_abap_file_utilities=>encoding_utf8.
        es_attachment_stream-mime_type = es_attachment_stream-mime_type && |; charset=UTF-8|.
      ENDIF.

    ENDIF.

Is there a neater way to achieve this? I'm not sure if it is a bug, as by default the attachment is meant to be downloaded by the browser (which is the case in desktop).

Accepted Solutions (1)

Accepted Solutions (1)

gabmarian
Active Contributor
0 Kudos

As I did not find any better solution I kept using this one. No drawbacks or side-effects was identified so far.

Answers (0)