Hi
Env :
Linux kernel 6.8.0-49 LUbuntu 2404 LXQT
Gnucobol just compiled last source version downloaded from this site
cobc (GnuCOBOL) 3.2.0
Built Mar 16 2025 16:41:54 Packaged Jul 28 2023 17:02:56 UTC
C version "13.2.0"
loading standard configuration file 'default.conf'
I Attach the code of a sample program to reproduce the problem
Program was able to display all the euro signs at the console...
But euro signs does not display when program clears screen and try to place them with "AT" position.. Dollars prints correctly.. i tried with UXTerm
here output of my "locale" command, i use US english as LANG and all other locale as italian
Gnucobol was compiled with extended screen I/O : ncursesw
Source pgm file was correctly saved as UTF-8
Whats wrong ?
It may be related to ncursesw ?
Thanks in advance for your support
Maurizio
Last edit: Maurizio Bongini 2025-03-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On Windows 10 here in the USA I found that when NOT using extended screen I/O, that GNUCOBOL used the default code for the windows console which is 437, However GNUCOBOL with CURSES uses the locale which for the USA is 1252, this results in some of the same behavior which you are reporting.
I think that there is a function which will return the CURRENCY SYMBOL based on the locale being used in your environment.
Simon would probably be able to address this better than I can.
Chuck Haatvedt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
the problem is not the currency sign .. i'm not able to display also other italian alphabet characters
like "à" an a with accent, many italian words ending with this letter...
i forget to delete windows code, i put an asterisk to column 7 , but in windows environment this pgm function very well with cp1252 ... i have problem in linux env only when i place text on the screen , so problem interfacing ncurses .. all characters are displayed correctly at the linux terminal using the dirst part of the code
Last edit: Maurizio Bongini 2025-03-31
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
define_XOPEN_SOURCE_EXTENDED#include<locale.h>#include"/usr/include/ncursesw/curses.h"intmain(){setlocale(LC_CTYPE,"");initscr();/* Start curses mode */move(2,2);printw("line 1 ");/* Print */move(3,2);printw("à è ò ù");/* Print */move(4,2);printw("€");/* Print */move(5,2);printw("\xe2\x82\xac\n");refresh();/* Print it on to the real screen */getch();/* Wait for user input */endwin();/* End curses mode */return0;}// gcc -Wall ncurses.c -o hello -lncursesw
in the last line i wrote gcc compile parameters
when i run ./hello i get the correct output.. (see attached file)
At this point, if C language is able to work correctly with ncursesw with my system settings
IMHO the problem is into Gnucobol , let me know if u have to compile again Gnucobol and reinstall because the LC_CTYPE was not setted or if i have to fo further testing for you
Thanks in advance
Maurizio
Just to ensure that there's not a bad comparison: what is the output of cobcrun --verbose --info?
In any case the main difference is the way the characters are handled. To follow COBOL rules and expectations we have to get one char out, step by step (and we want to bring it to a specific curses window).
Your source is encoded in UTF8, right? (A plain DISPLAY to that UTF8 terminal works, which only outputs each character to the stdout buffer and the terminal then reads that buffer for display.)
I guess you'd then need to indeed use the wide character functions, and possibly that would mean to convert the data (at least for a portable curses solution, I think you can just cast a char in ncurses and it still would work).
Maybe you want to give that a try, by adjusting the GnuCOBOL sources ? In this case have a look at the nightly build under download and take the 3.x tarball.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Next
As you can see from dates, i re-install the original Gnucobol ... but i still have the problem
Yes source file was saved UTF-8
i use Vim to edit and i save with
:w ++enc=utf-8
Now here is very late, i will study your post tomorrow
Thanks for the support
Maurizio
Last edit: Maurizio Bongini 2025-03-31
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Save the source in a codepage specific to your language (in my case it's German, so I use ISO-8859-15).
Compile the source with: cobc -x cobtest.cbl -lncurses
Run the program with: luit -encoding ISO-8859-15 -x ./cobtest
Here (I am running Fedora 40 Linux) it's showing all Euro signs correcty, except the UTF-8 one, but that is also correct as we are using another codepage.
Last edit: Klaus Siebke 2025-04-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Updated ..
Hi Simon
English is not my mother tongue.. i want to avoid misunderstanding..
Some years ago, i installed gnucobol, and old version to a debian machine, also this machine configured to have language en_US and all locale to italian.. and all function properly
i did not write the C test program because i feel myself a guru , but only for problem determination
A create the small cobol program to test some italian characters..
all characters displays correctly if i direct output to console. i immagine is stdout
None of the same set of characters display when use screen..
To check if there are problem in my installation i generate the sample C code..
at this point is clear than the issue is between Gnucobol ,and ncursesw
but i never write in my life a pgm interfacing with ncurses.. this is the first one
you show me the two instructions involved in the problem and explain me that i cannot simply change the waddch (mywin, c); with a printw ...
if i correctly understand i have to change waddch (mywin, c) with an wadd_wch() and when calling cob_addch_no_trunc_check i have to add a mbtowc
searching gnucobol nighty build goggle direct me to a sourceforge site where there is
version 3.2 stable, i think is the same i installed , and version 3.3 stable and another version 4
but try to download 3,3 end 4.0 i geta "forbid" message...
I miss something.. but if the problem is in the gnucobol source, are there some developpers ?
Please explain me the situation
regards.. Maurizio
Last edit: Maurizio Bongini 2025-04-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I recheck again, i'm working with the latest stable version .. how can i download the version you linked to me ? Please let me know otherwise i'm lost
can you contact one of the developper ? Please
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i'm working on ... i have not experience with ncurses at all , i will try to write a small program that perform this function, i do not grant anything to anyone ,, in the mean time i converted my screen sections to use ASCII character set ..
Last edit: Maurizio Bongini 2025-04-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Simon
I successfully write a C program to parse UTF-8 chars of different length from a string and to write, one by one to the screen, using wadd_wch
the program is very simple.. few instructions .. but sincerely i do not kow how to insert it on screenio.c .. it seems cob_screen_puts uses one byte ASCII character at time.. UTF-8 instead can range form 1 to 4 bytes long ...
i attached in this post the source of my pgm
compile it with
gcc -Wall widechar.c -o wc -lncursesw
can you pass this source to people who wrote screenio.c ? So they can merge correctly the code
At this moment i need italian utf-8 characters displayed at SCREEN SECTION
Thanks in advance..
Maurizio
Hi Simon
Any news ?
my needs is only to put utf-8 support at screen section and display command
in the mean time i take a look to IBM and they use PIC N to describe multibyte characters field..
i immagine this is an hard work...
IMHO .. is better to specify at installation time that utf-8 characters not yet supported when working with screen
Regards.
Maurizio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
IBM has PIC N for multibyte - which then applies to all characters (PIC N = 2 bytes per character, possibly split with combination chars) and PIC U for utf8, which is 1-4 bytes per character (btw: that is currently under work to be added to ISO COBOL).
GnuCOBOL has a rough support for those (mostly data storage, INSPECT REPLACING of utf with a different size won't work, utf8 and national literals may not work well (though support in 3.3 is already better and there's last year's GSOC to be integrated which improves that further) - but screenio just handles single-byte PIC X ("plain" DISPLAY to a terminal that has utf8 locale is likely to work, but that's more a co-incidence).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
Env :
Linux kernel 6.8.0-49 LUbuntu 2404 LXQT
Gnucobol just compiled last source version downloaded from this site
cobc (GnuCOBOL) 3.2.0
Built Mar 16 2025 16:41:54 Packaged Jul 28 2023 17:02:56 UTC
C version "13.2.0"
loading standard configuration file 'default.conf'
I Attach the code of a sample program to reproduce the problem
Program was able to display all the euro signs at the console...
But euro signs does not display when program clears screen and try to place them with "AT" position.. Dollars prints correctly.. i tried with UXTerm
here output of my "locale" command, i use US english as LANG and all other locale as italian
Gnucobol was compiled with extended screen I/O : ncursesw
Source pgm file was correctly saved as UTF-8
Whats wrong ?
It may be related to ncursesw ?
Thanks in advance for your support
Maurizio
Last edit: Maurizio Bongini 2025-03-29
further data to investigate
gnucobol was built with
libncurses-dev
ubuntu repository does not provide
libncursesw6-dev
Last edit: Maurizio Bongini 2025-03-31
On Windows 10 here in the USA I found that when NOT using extended screen I/O, that GNUCOBOL used the default code for the windows console which is 437, However GNUCOBOL with CURSES uses the locale which for the USA is 1252, this results in some of the same behavior which you are reporting.
I think that there is a function which will return the CURRENCY SYMBOL based on the locale being used in your environment.
Simon would probably be able to address this better than I can.
Hi
the problem is not the currency sign .. i'm not able to display also other italian alphabet characters
like "à" an a with accent, many italian words ending with this letter...
i forget to delete windows code, i put an asterisk to column 7 , but in windows environment this pgm function very well with cp1252 ... i have problem in linux env only when i place text on the screen , so problem interfacing ncurses .. all characters are displayed correctly at the linux terminal using the dirst part of the code
Last edit: Maurizio Bongini 2025-03-31
Hi
I add here further data to help
not only the euro sign does not work with ncurses but also other special italian characters
i
added to first part of my pgm works
Does not works, nothing displayed
it seems a problem related to ncurses
Last edit: Maurizio Bongini 2025-03-31
I put in the attachment output of c Program
i create also this other small c program to display € at console output
and it works correctly
Hi
i was able to display € sign and other italian characters with C Language using ncursesw , in the following post i will put the code
Last edit: Maurizio Bongini 2025-03-31
in the last line i wrote gcc compile parameters
when i run ./hello i get the correct output.. (see attached file)
At this point, if C language is able to work correctly with ncursesw with my system settings
IMHO the problem is into Gnucobol , let me know if u have to compile again Gnucobol and reinstall because the LC_CTYPE was not setted or if i have to fo further testing for you
Thanks in advance
Maurizio
Just to ensure that there's not a bad comparison: what is the output of
cobcrun --verbose --info
?In any case the main difference is the way the characters are handled. To follow COBOL rules and expectations we have to get one char out, step by step (and we want to bring it to a specific curses window).
As you can see in https://sourceforge.net/p/gnucobol/code/5469/tree/branches/gnucobol-3.x/libcob/screenio.c#l1783 this is not done with
printw()
but withwaddch ()
.But the part where the error likely happens is where we get the COBOL data and pass that to curses: https://sourceforge.net/p/gnucobol/code/5469/tree/branches/gnucobol-3.x/libcob/screenio.c#l1961 - we take the COBOL data, byte by byte, casting it to a chtype.
Doing so with UTF8 data (multi-byte) likely won't work; for the equivalence to your printw, it the code possibly needs to call
wadd_wch()
, but then the input likely needs to be converted viambtowc
...Your source is encoded in UTF8, right? (A plain
DISPLAY
to that UTF8 terminal works, which only outputs each character to the stdout buffer and the terminal then reads that buffer for display.)I guess you'd then need to indeed use the wide character functions, and possibly that would mean to convert the data (at least for a portable curses solution, I think you can just cast a char in ncurses and it still would work).
Maybe you want to give that a try, by adjusting the GnuCOBOL sources ? In this case have a look at the nightly build under download and take the 3.x tarball.
Hi Simon
Here command output
Next
As you can see from dates, i re-install the original Gnucobol ... but i still have the problem
Yes source file was saved UTF-8
i use Vim to edit and i save with
Now here is very late, i will study your post tomorrow
Thanks for the support
Maurizio
Last edit: Maurizio Bongini 2025-03-31
Hi Simon
Let me know when the ightly build with the above changes is available
I don't have time to do anything myself in this area - but you're invited to give it a go, starting with the nightly build.
Last edit: Simon Sobisch 2025-04-01
Could you please try this:
Here (I am running Fedora 40 Linux) it's showing all Euro signs correcty, except the UTF-8 one, but that is also correct as we are using another codepage.
Last edit: Klaus Siebke 2025-04-01
Hi Klaus
My Lubuntu 24.04 does not provide luit, it has x11-utils..
Updated ..
Hi Simon
English is not my mother tongue.. i want to avoid misunderstanding..
Some years ago, i installed gnucobol, and old version to a debian machine, also this machine configured to have language en_US and all locale to italian.. and all function properly
i did not write the C test program because i feel myself a guru , but only for problem determination
A create the small cobol program to test some italian characters..
all characters displays correctly if i direct output to console. i immagine is stdout
None of the same set of characters display when use screen..
To check if there are problem in my installation i generate the sample C code..
at this point is clear than the issue is between Gnucobol ,and ncursesw
but i never write in my life a pgm interfacing with ncurses.. this is the first one
you show me the two instructions involved in the problem and explain me that i cannot simply change the waddch (mywin, c); with a printw ...
if i correctly understand i have to change waddch (mywin, c) with an wadd_wch() and when calling cob_addch_no_trunc_check i have to add a mbtowc
searching gnucobol nighty build goggle direct me to a sourceforge site where there is
version 3.2 stable, i think is the same i installed , and version 3.3 stable and another version 4
but try to download 3,3 end 4.0 i geta "forbid" message...
I miss something.. but if the problem is in the gnucobol source, are there some developpers ?
Please explain me the situation
regards.. Maurizio
Last edit: Maurizio Bongini 2025-04-01
Last edit: Maurizio Bongini 2025-04-02
Hi...
I'm Trying to understand...
I take a look on the code i used to install gnucobol
i browse libcob/screenio.c
and i find the following ...
So i'm working with a different code ...
I recheck again, i'm working with the latest stable version .. how can i download the version you linked to me ? Please let me know otherwise i'm lost
can you contact one of the developper ? Please
https://sourceforge.net/projects/gnucobol/files/gnucobol/nightly_snapshots/ is the right place to get them, but there were some issue with the CI build, so the download did not work. I'm working on fixing that, but here's a deeplink to today's "artifacts" that you can use:
https://ci.appveyor.com/project/GitMensch/gnucobol-3-x/build/job/hhtdkm19qcdjkky5/artifacts
i'm working on ... i have not experience with ncurses at all , i will try to write a small program that perform this function, i do not grant anything to anyone ,, in the mean time i converted my screen sections to use ASCII character set ..
Last edit: Maurizio Bongini 2025-04-04
Hi Simon
I successfully write a C program to parse UTF-8 chars of different length from a string and to write, one by one to the screen, using
wadd_wch
the program is very simple.. few instructions .. but sincerely i do not kow how to insert it on screenio.c .. it seems cob_screen_puts uses one byte ASCII character at time.. UTF-8 instead can range form 1 to 4 bytes long ...
i attached in this post the source of my pgm
compile it with
can you pass this source to people who wrote screenio.c ? So they can merge correctly the code
At this moment i need italian utf-8 characters displayed at SCREEN SECTION
Thanks in advance..
Maurizio
Last edit: Maurizio Bongini 2025-04-09
Hi Simon
Any news ?
my needs is only to put utf-8 support at screen section and display command
in the mean time i take a look to IBM and they use PIC N to describe multibyte characters field..
i immagine this is an hard work...
IMHO .. is better to specify at installation time that utf-8 characters not yet supported when working with screen
Regards.
Maurizio
IBM has PIC N for multibyte - which then applies to all characters (PIC N = 2 bytes per character, possibly split with combination chars) and PIC U for utf8, which is 1-4 bytes per character (btw: that is currently under work to be added to ISO COBOL).
GnuCOBOL has a rough support for those (mostly data storage, INSPECT REPLACING of utf with a different size won't work, utf8 and national literals may not work well (though support in 3.3 is already better and there's last year's GSOC to be integrated which improves that further) - but screenio just handles single-byte PIC X ("plain" DISPLAY to a terminal that has utf8 locale is likely to work, but that's more a co-incidence).