Skip to content

Commit 82a0cf5

Browse files
hakonhaglandmohawk2
authored andcommitted
Fix STDIN input encoding for Windows
1 parent f5cdee6 commit 82a0cf5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/ExtUtils/MakeMaker.pm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,18 @@ sub prompt ($;$) { ## no critic
216216
print "$def\n";
217217
}
218218
else {
219+
my $codepage;
220+
if ($Is_Win32) {
221+
require Win32::Console;
222+
require Encode;
223+
my $codepage = Win32::GetConsoleCP(); # get the input code page
224+
}
219225
$ans = <STDIN>;
220226
if( defined $ans ) {
221227
$ans =~ s{\015?\012$}{};
228+
if ($Is_Win32) {
229+
$ans = Encode::decode("cp". $codepage, $ans);
230+
}
222231
}
223232
else { # user hit ctrl-D
224233
print "\n";

0 commit comments

Comments
 (0)