Skip to content

Commit f0e3a44

Browse files
committed
Write the WeBWorK::Upload info file UTF-8 encoded.
Of course then the file also has to be read as UTF-8. This fixes issue openwebwork#2690.
1 parent ded52af commit f0e3a44

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/WeBWorK/Upload.pm

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ sub store {
9090
croak "no upload specified" unless $upload;
9191

9292
# generate UUID
93-
my $ug = new Data::UUID;
93+
my $ug = Data::UUID->new;
9494
my $uuid = $ug->create_str;
9595

9696
# generate one-time secret
@@ -112,7 +112,7 @@ sub store {
112112
$upload->move_to($filePath);
113113

114114
# write info file
115-
open my $infoFH, ">", $infoPath
115+
open my $infoFH, '>:encoding(UTF-8)', $infoPath
116116
or die "failed to write upload info file $infoPath: $!";
117117
print $infoFH "$realFileName\n$secret\n";
118118
close $infoFH;
@@ -203,7 +203,7 @@ sub retrieve {
203203
croak "no upload matches the ID specified" unless -e $infoPath;
204204

205205
# get real file name and secret from info file
206-
open my $infoFH, "<", $infoPath
206+
open my $infoFH, '<:encoding(UTF-8)', $infoPath
207207
or die "failed to read upload info file $infoPath: $!";
208208
my ($realFileName, $secret) = <$infoFH>;
209209
close $infoFH;

0 commit comments

Comments
 (0)