Skip to Content
0

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

May 29, 2017 at 06:00 AM

404

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Sandra Rossi May 29, 2017 at 07:41 AM
1

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

Share
10 |10000 characters needed characters left characters exceeded
Andreas Lichtenau
May 29, 2017 at 08:42 AM
1

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hello Andreas,

Thanks for the suggestion.

yes, my system is Unicode enabled.

I tried the below code as well

 OPEN DATASET p_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

But my file is not encoded to UTF-8.

capture.png (1.3 kB)
0
muthukumaran subramanian

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.

1
Andreas Lichtenau
May 29, 2017 at 12:32 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded