Re: Problem with '€' (EURO) symbol in (U)CRT |printf("%S", ...);| ...

Brian Inglis Brian.Inglis@SystematicSW.ab.ca
Wed Nov 27 00:49:57 GMT 2024


On 2024-11-26 17:08, Roland Mainz via Cygwin wrote:
> Cygwin 3.5.4/Win10/64bit, the following program prints a '?' where I
> would expect a '€' (EURO) symbol:
> ---- snip ----
> printf '#include <stdio.h>\n#include <wchar.h>\n#include
> <io.h>\n#include <fcntl.h>\n#include <locale.h>\nint main(int ac, char
> *av[]) { setlocale(LC_ALL, ""); printf("%%S\\n", L"hello € world");
> return 0; }\n' >x.c && clang -target x86_64-pc-windows-gnu -Wall x.c
> -o x.exe && ./x.exe
> hello ? world
> ---- snip ----
> 
> My hope was that - because Win32 uses UTF-16 for |wchar_t| - that the
> EURO symbol can be displayed on any locale/code page which supports
> the EURO symbol, but somehow I always get a '?'.
> 
> Does anyone know what I am doing wrong ?

$ grep -aw EURO ~/src/charsets/unicode-symbols.txt
₠  U+20A0   EURO-CURRENCY SIGN
€  U+20AC   EURO SIGN
💶 U+1F4B6  BANKNOTE WITH EURO SIGN

What is your terminal locale and charset?

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry


More information about the Cygwin mailing list