I will have a look at the mingw-64 sources and maybe file an issue

Seems to be a runtime issue.
https://winlibs.com provides a gcc-13.2.0 build with msv C runtime, and a separate gcc-13.2.0 build with universal C runtime.
The one with UCRT provides the utf-8 support, the one with MSVCRT does not.

Strawberry Perl uses the MSVCRT one, and if you want to build perl-5.38.0 (or earlier) with the UCRT one, you'll need to patch the perl source.
But perl-5.39.2 builds straight out of the box with the UCRT one.
Hence my own personal build of perl-5.39.2 (built by gcc-13.2.0 UCRT) provides the desired behaviour.

It might be that the UCRT version of gcc-13.1.0 (and perhaps earlier) might also provide that utf-8 support. (I haven't tested.)
In any case, one can grab the UCRT gcc-13.2.0 and check that C programs are receiving that utf-8 support.

Cheers,
Rob

In reply to Re^4: Using setlocale() on Windows with utf-8 support by syphilis
in thread Using setlocale() on Windows with utf-8 support by gflohr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.