in reply to strftime does not handle Unicode characters in format argument properly (at least, not consistently)

strftime is implemented in glibc or your standard C library, so I don't think this issue is related specifically to Perl. Perhaps you can use POSIX::strftime for _just_ the numerical/time bits, then feed this into sprintf.
  • Comment on Re: strftime does not handle Unicode characters in format argument properly (at least, not consistently)

Replies are listed 'Best First'.
Re^2: strftime does not handle Unicode characters in format argument properly (at least, not consistently)
by Bruder Savigny (Initiate) on Sep 24, 2020 at 00:07 UTC

    Many thanks to both of you, and sorry for the somewhat belated answer. I have to admit I had worked under the impression that UTF-8 works out of the box with Perl, and had to read up a lot on that. I have now understood that you should not rely on that, even if it mostly looks like it. The fix using both use utf8 and use open ':encoding(UTF-8) worked perfectly for me as well. The suggestion of using strftime for the numbers only would definitely have been a workable fallback solution that I hadn't thought of.

    The only thing that really puzzles me is the different outcome between the non-breaking space and the other non-ASCII characters. But then, it seems Perl has to do quite complex things around Unicode.

    Thanks again, and best wishes!