Hello, we are migrating our Visual COBOL development for Eclipse from a AIX server to a Linux server. We have a utility to convert text from ASCII to UTF-8, but it has stopped working because the NATIONAL-OF function does not recognize UTF-8 characters in linux.
the locale data are
----AIX
LANG=C
LC_COLLATE="C"
LC_CTYPE="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_MESSAGES="C"
LC_ALL=
-----Linux
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=
And the code of the utility is :
PROGRAM-ID. anook2
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
file-control.
select futf8 assign to f-utf8
organization line sequential
status is io-estado.
select fascii assign to f-ascii
organization line sequential
status is io-estado.
DATA DIVISION.
file section.
fd fascii.
01 rascii pic x(50).
fd futf8.
01 rutf8 pic x(150).
WORKING-STORAGE SECTION.
01 io-estado pic xx.
88 io-ok value zeros.
01 l-cmd pic x(250).
01 rnat pic n(50) usage national.
01 f-ascii pic x(120) value spaces.
01 f-utf8 pic x(120) value spaces.
PROCEDURE DIVISION.
accept l-cmd from command-line
unstring l-cmd delimited all ' '
into f-ascii f-utf8
open output futf8
if not io-ok
display '!! error fichero de salida->' f-utf8
stop run
end-if
open input fascii
perform until not io-ok
read fascii
if not io-ok exit perform end-if
move function national-of(rascii, 819) to rnat
move function display-of(rnat, 1208) to rutf8
write rutf8
end-perform
close fascii, futf8
stop run.
We have a file in /tmp/ whose content is ó ( hexadecimal valueF3)
if we runs de program anook2 /tmp/fich_ent /tmp/fich_sal on AIX the out file has a hexadecimal value of C3B3(which is OK), but if uns de program anook2 /tmp/fich_ent /tmp/fich_sal on linux the out file has a hexadecimal value of E280 (error).
Any clues as to what the problem might be? Are we missing an environment variable?
Any compilation options?
