I don't know if I am doing some bad, but,
a) CURRENCY SIGN IS "€".
b) EUROCOIN PIC €9(2) VALUE 8.
c) SCREEN DISPLAYS... Ç08
With $ is all right. I tried to use hex value of € or keyboard combo (CTRL+5 in Windows) but it doesn't work.
Thanks in advance
I guess you save the file as utf-8? Try with a single-byte encoding for now instead.
... and "what does not work" exactly?
Hi Simon, and thanks for your answer :o)
I am saving file as ANSI (img attached). I am very confused... Can I write € symbol with keyboard (keyboard 5)? Yes. Can I write € simbol using a combo of keys in Windows (CTRL+ALT+E)? Yes. My code in COBOL, understand the € symbol? Yes. My COBOL code shows € when I DISPLAY? No, it shows Ç symbol. If I use $ symbol, all is fine.
Clues:
If I use @ symbol, it works fine (key nr 2 in Spansih and anglosaxon keyboard)
If I use & symbol, it works fine (key nr 6 in Spansih keyboard and 7 in anglosaxon keyboard)
If I use # symbol, it works fine (key nr 3 in Spansih and anglosaxon keyboard).
If I use ~ symbol, it works fine (key 4 in Spanish keyboard)
but... If I use Ç symbol, Ã symbol is DISPLAYED (one key further than " key in anglosaxon keyboard).
Tip:
Could be my Spanish keyboard? I see that symbols in keys quite similar to US/EN keyboards (keys with number printed) seems to work, but If I use other keys (like Ç), it doesn't work fine.
I am using OpenCobolIDE but I don't see anything about this in configuration.
So, I am very lost... I was looking in Google some solutions but I don't find an answer, so I went to here.
I go on trying to understand what is happening :o?
As noted: Your codepage in cmd is commonly a dos codepage, not ANSI (you may be able to temporarily set it to that with
chcp
, but even then you likely want something like ISO-8859-15, which "ANSI" means in the Windows Notepad).OCIDE came with different encodings, you may be able to use something reasonable with it; its integrated console may or may not work with something outside of 7bit (which includes @ & # ~, see https://en.wikipedia.org/wiki/ASCII#Character_set) or utf8; the later is not usable for
CURRENCY SIGN
with GnuCOBOL (we operate one-byte, not one-character here currently)In Windows, you can use CTRL+ALT+E to create a Euro symbol, but if there is no 8-bit glyph for it in your CMD.EXE codepage, it probably won't show up COBOL data.
What codepage do you use in Windows? Mine is 437 (OEM United States). As far as I know, it does NOT include the Euro symbol, or any characters other than 8-bit Windows ASCII.
https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
You actually have two separate problems, first how to use the Euro symbol in you COBOL source code for Picture clauses, and how to display the Euro Symbol from a GnuCOBOL program.
Maybe you could use the CHCP commmand in CMD.EXE to change to code page 850 (OEM Latin-1, Western European (DOS)). That code page ought to have an 8-bit Euro currency symbol.
Of course UTF-8 and UTF-16 should be able to use many different currency symbols, but I don't know how to set up GnuCOBOL for UTF-8 source code.
Similar problems occur for USA programmers when trying to display the symbol for UK Pounds Sterling.
Hummmmm quite interesting Arnold!! It could be the problem, good point.
I am going to see if I can solve it with that point of view. Thanks! I will inform you all when I discover what is happening.
If I didn't anything wrong, CMD understands € symbol (image attached).
I go on investigating...
it all depends on the codepage - if you want to see the euro sign on cmd (warning, extended screenio may' be different) then your COBOL source needs to be encoded using the appropriate codepage (edit with Notepad++ or VSCodium or similar, not the Windows included Editor which doesn't support those codepages); and with current GnuCOBOL ensure that this is a single-byte encoding
Thanks for your help, Simon. I understood the problem now, because I was doing all right and I didn't understood what was happening.
OpenCobol IDE has a bug, NOT GNUCobol. I saw it in other web about COBOL learning. I have UTF-8 activated but it doesn't work.
Attached image.
I will try to speak with OpenCobol IDE developer. Thanks!!