in reply to strftime does not handle Unicode characters in format argument properly (at least, not consistently)
#!/usr/bin/perl use strict; use warnings; use utf8; use open OUT => ':encoding(UTF-8)', ':std'; use POSIX qw(strftime); my $string = 'hailed an über ‘cab’ on '; my @t = (0, 0, 0, 23, 5, 2020, 4); my $nbsp = chr 160; print $string . strftime( '%d/%b', @t), "\n"; print $string . strftime( "%d$nbsp%b", @t), "\n"; print $string . strftime("‘%d$nbsp%b’", @t), "\n"; print $string . strftime('‘%d %b’', @t), "\n";
Update: I used the $nbsp here, as PerlMonk replaces the non-breakable space with a normal ASCII space, but it works with the nbsp character directly in the script, too.
|
|---|