Skip to Content
avatar image
Former Member

How to output the file to application server in the UTF-8 format without BOM?

Hello All,

I have to upload a file in the UTF-8 format without BOM.

I tried the below code but the format of the file is still ANSI.

 OPEN DATASET p_path FOR OUTPUT IN TEXT MODE ENCODING UTF-8
 MESSAGE lv_msg WITH WINDOWS LINEFEED.

Then I tried with the below code, I can able to get the File format as UTF-8 with BOM.

 OPEN DATASET p_path FOR OUTPUT IN TEXT MODE ENCODING UTF-8
 WITH BYTE-ORDER MARK MESSAGE lv_msg WITH WINDOWS LINEFEED.

But i want my file to be in the UTF-8 without BOM format. Please help on this.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • May 29, 2017 at 07:41 AM

    If your SAP system is Unicode, then UTF-8 is the default behavior. Use OPEN DATASET ... IN TEXT MODE ENCODING DEFAULT ...

    cf ABAP documentation : OPEN DATASET - encoding

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 29, 2017 at 08:42 AM

    Dear Muthukumaran,

    is your system a Unicode system?


    In this case try:

    OPEN DATASET p_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT

    Further information are provided in notes #27 and #1731360.

    Best,
    Andreas

    Add comment
    10|10000 characters needed characters exceeded

    • If it's not UTF-8, then it'd be a bug in the kernel. But I'd be more incline to think that it's UTF-8 but either you don't display the file with the right tool, or the data you have written to the file was erroneous before the TRANSFER.

  • avatar image
    Former Member
    May 29, 2017 at 12:32 PM

    Dear Muthukumaran,

    I agree with Sandra.
    If you use ENCODING DEFAULT then it should be UTF-8 encoding and we should check the reading side. Probably we have the error on this side.

    Is it possible to attach a file for checking if it is UTF-8 or not?

    Cheers,
    Andreas

    Add comment
    10|10000 characters needed characters exceeded