Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Open dataset ignoring Byte order Marker

thomas_blas
Explorer
0 Likes
1,108

Dear Experts,

for an interface we are uploading text files (format UTF-8) from application server (AIX system) using "OPEN DATASET file IN TEXT MODE ENCODING DEFAULT FOR INPUT." Some of the source systems are sending these files with BoM (Byte order marker) other systems without.

For correct data transfer and processing I have to ignore the BoM.

Is there any possibility to ignore the BoM during reading of the file?

Thank you in advance for your help.

Thomas

2 REPLIES 2
Read only

thomas_blas
Explorer
0 Likes
752

I just found the solution - I've to use addition "SKIPPING BYTE-ORDER MARK" (see note 788449)

Read only

Former Member
0 Likes
752

Hi Thomas,

Check if file contains BOM depending on the type.

cl_abap_file_utilities=>check_for_bom( l_file ) = cl_abap_file_utilities=>bom_utf16_le.

or

cl_abap_file_utilities=>check_for_bom( l_file ) = cl_abap_file_utilities=>bom_utf8.

if required then you can skip byte-order mark wiht:

OPEN DATASET l_file FOR INPUT IN BINARY MODE AT POSITION 2.


So it will leave 2 two bytes...


Best Regards,

Ferenc