Permalink
Browse files

silencing wide-character in-memory file handle error

RT#84198
  • Loading branch information...
Tom Wyant authored and yanick committed Mar 31, 2013
1 parent a2c8980 commit dafec693a62fa1d40173f7780e837ceb1c110aea
Showing with 12 additions and 1 deletion.
  1. +12 −1 t/02_request/14_uploads.t
View
@@ -16,9 +16,20 @@ sub test_path {
}
my $filename = "some_\x{1A9}_file.txt";
+my $filename_as_bytes = $filename;
+if ( $] >= 5.017009 ) {
+ # The following song-and-dance is because Perl has, in 5.17.9,
+ # started flagging wide characters in in-memory files as errors, to
+ # wit:
+ # Strings with code points over 0xFF may not be mapped into
+ # in-memory file handles
+ open my $out, '>:encoding(utf8)', \$filename_as_bytes;
+ print { $out } "some_\x{1A9}_file.txt";
+ close $out;
+}
my $content = qq{------BOUNDARY
-Content-Disposition: form-data; name="test_upload_file"; filename="$filename"
+Content-Disposition: form-data; name="test_upload_file"; filename="$filename_as_bytes"
Content-Type: text/plain
SHOGUN

0 comments on commit dafec69

Please sign in to comment.