Skip to Content
0
Former Member
Dec 27, 2007 at 08:07 AM

UTF-8 file creation using ABAP

379 Views

I want to create a UTF-8 file on Application Server.

Question 1:

I tried using statement 'Open dataset for output in text mode encoding utf-8'. The file was created. Then I used CL_ABAP_FILE_UTILITIES=>CHECK_UTF8 to check the encoding. 'A' was returned respresenting ASC.

Any suggestion on this?

Or is there any option to convert a ASC file to UTF-8?

Question 2:

After creating the file on Application Server, I used code below to check the encoding.

call method CL_ABAP_FILE_UTILITIES=>CHECK_UTF8

EXPORTING

file_name = fname

IMPORTING

encoding = encoding.

if encoding = CL_ABAP_FILE_UTILITIES=>ENCODING_UTF8.

write: / fname, 'File format is UTF-8.'.

else.

write: / fname, 'File format is not UTF-8.'.

endif.

When I was using this method to check a local file, i got error. can't this method do that?

Thanks.

Legend.