Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Open UTF-8 file in non-unicode system

Hi,

my SAP system is non-unicode My code page is 1100 (based onISO 8859-1) : https://en.wikipedia.org/wiki/ISO/IEC_8859-1

I need to open a external file encoding in UTF8 and i would like just have alphabetics characters but also graphics characters (00C8, 00C9, 00CA...)

Thanks for your help

My test program :

DATA: lv_str TYPE string,

        im_filename type string VALUE '\\test.xhtml',

        lv_data type string.

   TRY.

       OPEN DATASET im_filename FOR INPUT in TEXT MODE ENCODING NON-UNICODE.

       DO.

         READ DATASET im_filename INTO lv_str.

         IF sy-subrc NE 0.

           EXIT.

         ELSE.

           WRITE: /, lv_str.

           CONCATENATE lv_data lv_str INTO lv_data.

         ENDIF.

       ENDDO.

       CLOSE DATASET im_filename.

     CATCH cx_sy_file_open.

   ENDTRY.

replied

Solution :

OPEN DATASET im_filename FOR INPUT IN TEXT MODE ENCODING UTF-8 SKIPPING BYTE-ORDER MARK.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question