genutf8.pl 633 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env perl
  2. # Create test comparison data using a different UTF-8 implementation.
  3. # The generated utf8.dat file must have the following MD5 sum:
  4. # cff03b039d850f370a7362f3313e5268
  5. use strict;
  6. # 0xD800 - 0xDFFF are used to encode supplementary codepoints
  7. # 0x10000 - 0x10FFFF are supplementary codepoints
  8. my (@codepoints) = (0 .. 0xD7FF, 0xE000 .. 0x10FFFF);
  9. my $utf8 = pack("U*", @codepoints);
  10. defined($utf8) or die "Unable create UTF-8 string\n";
  11. open(FH, ">:utf8", "utf8.dat")
  12. or die "Unable to open utf8.dat: $!\n";
  13. print FH $utf8
  14. or die "Unable to write utf8.dat\n";
  15. close(FH);
  16. # vi:ai et sw=4 ts=4: