Skip to content

Commit 125cd23

Browse files
author
Kai Moschcau
committed
time: Enable time/time to print its output in UTF8
This fixes i3 bar parsing errors when the output contains characters not in the US-ASCII encoding space like the ä in the German März (March). Perl will by default print in US-ASCII/Latin-1 encoding, where especially the latter can contain characters that are not valid in UTF8. If that happens, this will cause the entire parsing of the i3blocks output to fail in i3 bar and cause it to only show an error message.
1 parent 46ccb08 commit 125cd23

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

time/time

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ if (!exists $display_map{$ENV{TZ}}) {
5555
}
5656
$tz_display = $display_map{$ENV{TZ}};
5757

58+
binmode(STDOUT, ":utf8");
5859
my $time = strftime($format, localtime());
5960
if ($tz_display eq "") {
6061
print "$time\n";

0 commit comments

Comments
 (0)