‎2009 Mar 31 9:34 AM
Hi Experts,
I have a problem where the file generated as UTF-8 format but the the checking always shown 'Non UTF-8'?
OPEN DATASET docid FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
LOOP AT i_outfile.
TRANSFER i_outfile TO docid LENGTH 1000.
ENDLOOP.
CLOSE DATASET docid.
IF cl_abap_file_utilities=>check_for_bom( docid ) = cl_abap_file_utilities=>bom_utf8.
WRITE 'UTF-8'.
ELSE.
WRITE 'Non UTF-8'.
ENDIF.
Hope you can shed some light here.
‎2009 Apr 01 1:51 AM
‎2009 Apr 01 2:16 AM
try this:
OPEN DATASET docid FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
if sy-subrc NE 0.
exit.
else.
LOOP AT i_outfile.
TRANSFER i_outfile TO docid LENGTH 1000.
ENDLOOP.
CLOSE DATASET docid.
endif.
‎2009 Apr 01 2:30 AM
Thanks Jay for proposing solution. However, there is no problem with OPEN DATASET ... ENCODING UTF-8 statement and the UTF-8 file created successfully.
‎2009 Apr 01 2:40 AM
try it in byte mode rather than text mode. uTF-8 and UTF-16 etc are related to bytes...
[UNICODE INTERFACES u2013 DATA EXCHANGE BETWEEN UNICODE AND NON-UNICODE SYSTEMS|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10fe20ed-b611-2a10-a2ba-d5665779c10c]
‎2009 Apr 01 2:56 AM
Jay,
Do you mean OPEN DATASET ... IN BINARY MODE? There is no such syntax as IN BYTE MODE. I tried BINARY MODE but not working.
‎2009 Apr 01 6:48 AM
To make my question clearer,
How to create a UTF-8 file in application server with BOM (Byte-Order Mark)?
‎2009 Apr 01 8:29 AM
‎2009 Apr 08 2:51 PM
Hi Girish
I am having a similar problem, when I transfer the data to .DAT file..some sp. char appers with £ sign.
How did you solved the problem, if you can guide me that will be great.
thanks
Anup
‎2010 Feb 04 12:45 PM
As usual : someone find the answer and do not post it... Worse!! He comes to say he has found it and do not post it... We see that too many times on this forum.
Anyway here's my solution in this post : helped by the previous answers !
I had to pass through an xstring for convertion but it's quite easy.