‎2012 Jul 12 3:49 AM
Hi friends,
Will "OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING NON-UNICODE" cause any problem when reading a UNICODE file? Do you have idea how to check the encoding of the file? Thanks.
Thanks, gk
‎2012 Jul 12 6:12 AM
Hello,
Please follow the given syntax:
OPEN DATASET dataset_name FOR access IN TEXT MODE ENCODING DEFAULT.
Regards,
Vaibhav Singhania
‎2012 Jul 12 7:01 AM
Thanks Vaibhav Singhania.
"OPEN DATASET dataset_name FOR access IN TEXT MODE ENCODING DEFAULT." will cause issue when reading a NON-UNICODE text file.
My program is used to read a UNIX text file and then download it to the local PC.
The UNIX text file may contains special character such as "é". If i used this statement (OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT), it will hit CONVT_CODEPAGE runtime error. If i used this statement (OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.), although it did not hit CONVT_CODEPAGE runtime error, but when i checked the downloaded text file, i found that the special character "é" appears as "#".
‎2012 Jul 25 12:56 PM
Hi,
you need to select the Unicode option in case of a utf-8 based file and the Non-Unicode option (+ correct logon language - sy-langu) in case of a Non-Unicode one.
If this does not fit, you get either an error, Hashes ("#") or Gibberish ...
Best regards,
Nils Buerckel
‎2012 Jul 25 1:54 PM
Hi gk,
if your program does nothing else but read from server and download to client, try binary mode.
Or just use function module ARCHIVFILE_SERVER_TO_CLIENT. Simple. Too simple?
Regards
Clemens
‎2012 Jul 25 2:09 PM
gk goh wrote:
... Do you have idea how to check the encoding of the file? ...
You can use the methods of the class CL_ABAP_FILE_UTILITIES to check the encoding of an app server file. Read the individual method documentation for details on how to use this class. Based on the encoding info you get from the class you can use the proper ENCODING option with OPEN DATASET.
Else as suggested by you can use the BINARY MODE option & forget about the file encoding.
BR,
Suhas
Message was edited by: Suhas Saha