diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-11-22 17:38:58 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-11-22 17:38:58 +0000 |
commit | 19950f85c62cc7f4cdcec70cf1d751780a9ebcdd (patch) | |
tree | 8454f7220b1d18b21965c35745ec8a6e82e1e2d0 | |
parent | 2711342ff3a0ab8c15fc3b096d9c95bbf7ba9d86 (diff) |
Don't double-decode strftime output.
As with d3d0ab6d, we need to only decode_utf8 strftime output that has
not already been decoded, to prevent errors in Perl 5.20+.
-rw-r--r-- | perllib/Utils.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/perllib/Utils.pm b/perllib/Utils.pm index 84c09d09d..7dd2a3f39 100644 --- a/perllib/Utils.pm +++ b/perllib/Utils.pm @@ -178,16 +178,17 @@ sub prettify_dt { } $tt .= ', ' unless $type eq 'date'; if ($dt->strftime('%Y %U') eq $now->strftime('%Y %U')) { - $tt .= decode_utf8($dt->strftime('%A')); + $tt .= $dt->strftime('%A'); } elsif ($type eq 'zurich') { - $tt .= decode_utf8($dt->strftime('%e. %B %Y')); + $tt .= $dt->strftime('%e. %B %Y'); } elsif ($type eq 'short') { - $tt .= decode_utf8($dt->strftime('%e %b %Y')); + $tt .= $dt->strftime('%e %b %Y'); } elsif ($dt->strftime('%Y') eq $now->strftime('%Y')) { - $tt .= decode_utf8($dt->strftime('%A %e %B %Y')); + $tt .= $dt->strftime('%A %e %B %Y'); } else { - $tt .= decode_utf8($dt->strftime('%a %e %B %Y')); + $tt .= $dt->strftime('%a %e %B %Y'); } + $tt = decode_utf8($tt) if !utf8::is_utf8($tt); return $tt; } |