04-29-2008 8:42 PM
Hi,
I have file is in appl server . before reading this file i need to validate whether the file is utf-8 or not.
ie
Before calling OPEN DATASET
Any Info?
a®
04-30-2008 5:37 AM
Hello
Please have a look at the following sources:
[Unicode File Handling in ABAP|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2194] [original link is broken] [original link is broken] [original link is broken];
[Unicode Interface|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10fe20ed-b611-2a10-a2ba-d5665779c10c]
[Unicode Interfaces (TechED)|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0928b44-b811-2a10-7599-cc4bb6585c46]
Regards
Uwe
04-29-2008 8:59 PM
hi check this...
fgetc is an C function to read your file bytes and is detecting a problem with charset encoding.
Check your profile file =/usr/sap/PRD/SYS/profile/PRD_DVEBMGS00_ap-s-sap is encoded with UTF-8 charset. You can use "file" command (see man file) or your text editor (Are you on unix or linux?).
You may also check the default encoding for your system with command "locale charmap" (maybe it is iso-8859-1 or ASCII if you are using unix). Check also whether your system has UTF-8 locale support enabled (command "locale -a"). Check the contents of the env valiable LANG, because you are using the locale informed in this variable.
C libraries use the encoding specified in env variable LC_CTYPE or LANG (In that order)
Your SAP system expects UTF-8 because your SAP installation may be Unicode.
regards,
venkat
04-30-2008 1:40 AM
04-30-2008 5:37 AM
Hello
Please have a look at the following sources:
[Unicode File Handling in ABAP|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2194] [original link is broken] [original link is broken] [original link is broken];
[Unicode Interface|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10fe20ed-b611-2a10-a2ba-d5665779c10c]
[Unicode Interfaces (TechED)|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0928b44-b811-2a10-7599-cc4bb6585c46]
Regards
Uwe
04-30-2008 2:49 PM
Uwe,
Your reply got solution for my issue.
please find below is code for my sulution.
cl_abap_file_utilities=>check_utf8(
exporting file_name = p_file
importing encoding = lv_encoding ).
if lv_encoding = cl_abap_file_utilities=>encoding_utf8.
open dataset p_file for input in text mode
encoding utf-8 skipping byte-order mark.
else.
open dataset p_file for input in text mode
encoding default.
endif.
a®
04-30-2008 11:17 AM
HI,
Try using the fallowing simple code,it will determine the file is UTF-8 or not.
cl_abap_file_utilities=>check_for_bom( <File Name> ) = cl_abap_file_utilities=>bom_utf8.
BR,
Rajani Kanth