Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CONVT_CODEPAGE runtime error

Former Member
0 Likes
12,851

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
6,494

Hi GK,

Try this :-

OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.

Thanks,

Best regards,

Prashant

9 REPLIES 9
Read only

Former Member
0 Likes
6,495

Hi GK,

Try this :-

OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.

Thanks,

Best regards,

Prashant

Read only

0 Likes
6,494

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.

Read only

0 Likes
6,494

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

Read only

0 Likes
6,494

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.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
6,494

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

Read only

Former Member
0 Likes
6,494

Hi Suhas,

Kindly refer to the attached file :-

Read only

Former Member
0 Likes
6,494

Hi Suhas, thanks for your suggestion. I tried BINARY mode but it did not work out correctly. The file appears like below :-

###†###################†††††††††††††††††††††††††####†††††††††††††††††††††###††#†#####†††††††††††††††††††††††††††††††††††††††††††††######†###††††††††††††††††††††††††††††††††††††††††††††††††#######††††††††††††††††††††††††††††††††††††††††††††††††††††††††#######†††###

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
6,494

Hi,

Where did you view this file? Did you download it to the local PC?

BR,

Suhas

Read only

Former Member
0 Likes
6,494

Yes Suhas, it is a unix file and my program is used to download it to local PC. Thanks.