2009 Nov 17 1:03 PM
Hello ALL,
I get data in binary format. Based on the data in the internal table, I need to convert it into UTF-8.
I want to convery only the data which are ANSI.
means.
first case: i get the data in ansi. i will convert it into utf-8.
second case. i get the data in utf-8. i will not convert this data.
is there any method from which I can identify from the binary data, that the current data is in ANSI format or UTF-8 format.
Please help.
2009 Nov 17 1:58 PM
Please tell Mukul, that if he uses 2 user ID's to duplicate post questions... then we will randomly delete one of the two user ID's...
Thanks,
Julius
2009 Nov 17 2:08 PM
2010 Dec 10 12:03 PM
I used the following method to find out.....
OPEN DATASET app_sr FOR OUTPUT IN BINARY MODE.
LOOP AT lt_ascii INTO ls_ascii.
TRANSFER ls_ascii TO app_sr.
ENDLOOP.
CLOSE DATASET app_sr.
COMMIT WORK.
TRY.
CALL METHOD cl_abap_file_utilities=>check_utf8
EXPORTING
file_name = app_sr
IMPORTING
encoding = encoding.
CATCH cx_sy_file_open .
CATCH cx_sy_file_authority .
CATCH cx_sy_file_io .
ENDTRY.
DELETE DATASET app_sr.
IF encoding = 'U'.
The file is utf-8
ENDIF.