From 22550d0ab3328554922822ca0207996b3d1bb73e Mon Sep 17 00:00:00 2001 From: Mark Pulford Date: Mon, 16 May 2011 19:34:35 +0930 Subject: Use Perl builtin UTF-8 support, not Text::Iconv Remove Perl dependency on Text::Iconv to improve portability. --- tests/genutf8.pl | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/genutf8.pl b/tests/genutf8.pl index 6a522dd..bbef91f 100755 --- a/tests/genutf8.pl +++ b/tests/genutf8.pl @@ -2,25 +2,31 @@ # Create test comparison data using a different UTF-8 implementation. +# The generation utf8.dat file must have the following MD5 sum: +# cff03b039d850f370a7362f3313e5268 + use strict; use warnings; -use Text::Iconv; use FileHandle; # 0xD800 - 0xDFFF are used to encode supplementary codepoints # 0x10000 - 0x10FFFF are supplementary codepoints my (@codepoints) = (0 .. 0xD7FF, 0xE000 .. 0x10FFFF); -my ($utf32be) = pack("N*", @codepoints); -my $iconv = Text::Iconv->new("UTF-32BE", "UTF-8"); -my ($utf8) = $iconv->convert($utf32be); +my ($utf8); +{ + # Hide "Unicode character X is illegal" warnings. + # We want all the codes to test the UTF-8 escape decoder. + no warnings; + $utf8 = pack("U*", @codepoints); +} defined($utf8) or die "Unable create UTF-8 string\n"; my $fh = FileHandle->new(); -$fh->open("utf8.dat", ">") +$fh->open("utf8.dat", ">:utf8") or die "Unable to open utf8.dat: $!\n"; -$fh->print($utf8) - or die "Unable to write utf.dat\n"; +$fh->write($utf8) + or die "Unable to write utf8.dat\n"; $fh->close(); # vi:ai et sw=4 ts=4: -- cgit v1.2.3-55-g6feb