Skip to content

Commit 1fe2652

Browse files
committed
Porting/acknowledgements.pl: fix encoding of author names
Previously, running `Porting/acknowledgements.pl` or `Porting/updateAUTHORS.pl --who` in a "UTF-8 by default" environment (such as with `LANG=en_US.UTF-8 PERL_UNICODE=SL`) would mangle non-ASCII characters in authors' names. (More specifically, it would double-encode non-ASCII characters, so "Mannsåker" would render as "MannsÃ¥ker".)
1 parent 33a8b15 commit 1fe2652

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Porting/acknowledgements.pl

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ =head1 DESCRIPTION
2020
use strict;
2121
use warnings;
2222
use autodie;
23+
use Encode qw(decode_utf8);
2324
use POSIX qw(ceil);
2425
use Text::Wrap;
2526
use Time::Piece;
2627
use Time::Seconds;
2728
use version;
29+
30+
binmode STDOUT, ':encoding(UTF-8)';
31+
binmode STDERR, ':encoding(UTF-8)';
32+
2833
$Text::Wrap::columns = 77;
2934

3035
my $since_until = shift;
@@ -162,6 +167,6 @@ sub commify {
162167

163168
# returns a list of the authors
164169
sub authors {
165-
return
170+
return decode_utf8
166171
qx($^X Porting/updateAUTHORS.pl --who $since_until);
167172
}

Porting/updateAUTHORS.pl

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ package App::Porting::updateAUTHORS;
6565
);
6666

6767
sub main {
68+
# we encode_utf8() manually
69+
binmode STDOUT;
70+
binmode STDERR;
71+
6872
local $Data::Dumper::Sortkeys= 1;
6973
my %opts= (
7074
authors_file => "AUTHORS",

0 commit comments

Comments
 (0)