aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/genutf8.pl19
1 files changed, 5 insertions, 14 deletions
diff --git a/tests/genutf8.pl b/tests/genutf8.pl
index bbef91f..db661a1 100755
--- a/tests/genutf8.pl
+++ b/tests/genutf8.pl
@@ -2,31 +2,22 @@
2 2
3# Create test comparison data using a different UTF-8 implementation. 3# Create test comparison data using a different UTF-8 implementation.
4 4
5# The generation utf8.dat file must have the following MD5 sum: 5# The generated utf8.dat file must have the following MD5 sum:
6# cff03b039d850f370a7362f3313e5268 6# cff03b039d850f370a7362f3313e5268
7 7
8use strict; 8use strict;
9use warnings;
10use FileHandle;
11 9
12# 0xD800 - 0xDFFF are used to encode supplementary codepoints 10# 0xD800 - 0xDFFF are used to encode supplementary codepoints
13# 0x10000 - 0x10FFFF are supplementary codepoints 11# 0x10000 - 0x10FFFF are supplementary codepoints
14my (@codepoints) = (0 .. 0xD7FF, 0xE000 .. 0x10FFFF); 12my (@codepoints) = (0 .. 0xD7FF, 0xE000 .. 0x10FFFF);
15 13
16my ($utf8); 14my $utf8 = pack("U*", @codepoints);
17{
18 # Hide "Unicode character X is illegal" warnings.
19 # We want all the codes to test the UTF-8 escape decoder.
20 no warnings;
21 $utf8 = pack("U*", @codepoints);
22}
23defined($utf8) or die "Unable create UTF-8 string\n"; 15defined($utf8) or die "Unable create UTF-8 string\n";
24 16
25my $fh = FileHandle->new(); 17open(FH, ">:utf8", "utf8.dat")
26$fh->open("utf8.dat", ">:utf8")
27 or die "Unable to open utf8.dat: $!\n"; 18 or die "Unable to open utf8.dat: $!\n";
28$fh->write($utf8) 19print FH $utf8
29 or die "Unable to write utf8.dat\n"; 20 or die "Unable to write utf8.dat\n";
30$fh->close(); 21close(FH);
31 22
32# vi:ai et sw=4 ts=4: 23# vi:ai et sw=4 ts=4: