The question was: Is it possible to activate a UTF-8 locale on Windows?
It looks like it's probably working for me on Windows 11, but only if the C toolchain that built perl (or that builds your executable) is a Microsoft one.
Here's a copy'n'paste (that doesn't render exactly as it appears) of what I get, having built your demo C program (into try.exe) using Visual Studio 2022:
D:\C>try.exe German.utf8
German_Germany.utf8: März (5 bytes)
And here's what I get using perl-5.38.0 that was built with the same Visual Studio 2022 compiler:
D:\>perl -MPOSIX -wle "$loc = POSIX::setlocale( LC_ALL, 'German.utf8'
+); print $loc;"
German_Germany.utf8
But if I use my perl-5.38.0 that was built with a mingw-w64 port of gcc-13.1.0, then I get:
D:\>perl -MPOSIX -wle "$loc = POSIX::setlocale( LC_ALL, 'German.utf8'
+); print $loc;"
Use of uninitialized value $loc in print at -e line 1.
And if I use that gcc-13.1.0 to build your C program into try_gcc.exe, then I get:
D:\C>try_gcc.exe German.utf8
(null): March (5 bytes)
From which I deduce that the behavior you need has not yet been ported to the mingw-w64 toolchain.
If you need it to work with the mingw-w64 compilers then you could make enquiries about that by (eg) posting to mingw-w64-public@lists.sourceforge.net .
Cheers,
Rob
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.