2012 Jul 11 8:52 AM
Hi friends,
My program will read a text file that may contains characters such as "é".
May i know is this a non-UTF8 character?
I was using this statement to read the text file :-
OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT
However, it failed with this runtime error :-
| Runtime Errors | CONVT_CODEPAGE |
| Exception | CX_SY_CONVERSION_CODEPAGE |
At the conversion of a text from codepage '4110' to codepage '4102':
I searched the web for solution.
Some forum posts recommend to use this statement instead :-
OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.
If I change to use this statement, may i know will it work well when reading a UTF-8 text file (or normal text file without those special characters such as "é")?
Thanks in advance for your help.
Thanks, gk
2012 Jul 11 9:02 AM
Hi GK,
Try this :-
OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
Thanks,
Best regards,
Prashant
2012 Jul 11 9:02 AM
Hi GK,
Try this :-
OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
Thanks,
Best regards,
Prashant
2012 Jul 11 9:09 AM
Thanks Prashant.
I tried this method already. Although the program did not give the error dump, but when i checked the downloaded text file, the special character "é" was not downloaded correctly. It appears as "#" instead of "é". Thanks.
2012 Jul 11 9:13 AM
Hi GK,
Well in that case, download the file on presentation server. Then open it in notepad & save it with ENCONDING as UNICODE. Check whether the special character is retained.
Then upload this file to application server & run the program.
Thanks,
Best regards,
Prashant
2012 Jul 11 9:26 AM
Hi Prashant, sorry as i am not clear enough in describing my problem.
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 "#".
I followed your instruction to save the downloaded text file in UNICODE but the special character "é" still appears as "#".
Thanks for your help.
2012 Jul 11 10:00 AM
Hello gk,
Can you please check in SCP(T-Code) which Code Pages(CP) contain the character - é (U+00E9)? If it's possible provide a screenshot as well
I just checked in my system & the character is available in CPs - 4110 & 4102.
"My program is used to read a UNIX text file and then download it to the local PC." - If this is the case you can open the file in BINARY MODE & download it to the local PC as a 'BIN'(ary) file as well. The rationale behind doing this is when a file is read in binary mode, the contents are transferred w/o any conversion.
BR,
Suhas
2012 Jul 11 10:22 AM
2012 Jul 11 10:24 AM
Hi Suhas, thanks for your suggestion. I tried BINARY mode but it did not work out correctly. The file appears like below :-
###†###################†††††††††††††††††††††††††####†††††††††††††††††††††###††#†#####†††††††††††††††††††††††††††††††††††††††††††††######†###††††††††††††††††††††††††††††††††††††††††††††††††#######††††††††††††††††††††††††††††††††††††††††††††††††††††††††#######†††###
2012 Jul 11 12:02 PM
Hi,
Where did you view this file? Did you download it to the local PC?
BR,
Suhas
2012 Jul 12 2:08 AM
Yes Suhas, it is a unix file and my program is used to download it to local PC. Thanks.