3 # text-utf8.t -- Test Pod::Text with UTF-8 input.
5 # Copyright 2002, 2004, 2006, 2007, 2008 by Russ Allbery <rra@stanford.edu>
7 # This program is free software; you may redistribute it and/or modify it
8 # under the same terms as Perl itself.
12 if ($ENV{PERL_CORE}) {
15 unshift (@INC, '../blib/lib');
17 unshift (@INC, '../blib/lib');
21 # UTF-8 support requires Perl 5.8 or later.
25 print "ok $n # skip -- Perl 5.8 required for UTF-8 support\n";
32 print "not ok 1\n" unless $loaded;
40 my $parser = Pod::Text->new or die "Cannot create parser\n";
42 eval { binmode (\*DATA, ':encoding(utf-8)') };
43 eval { binmode (\*STDOUT, ':encoding(utf-8)') };
45 next until $_ eq "###\n";
46 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
47 eval { binmode (\*TMP, ':encoding(utf-8)') };
48 print TMP "=encoding UTF-8\n\n";
50 last if $_ eq "###\n";
54 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
55 $parser->parse_from_file ('tmp.pod', \*OUT);
57 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
58 eval { binmode (\*TMP, ':encoding(utf-8)') };
65 unlink ('tmp.pod', 'out.tmp');
68 last if $_ eq "###\n";
71 if ($output eq $expected) {
75 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
80 # Below the marker are bits of POD and corresponding expected text output.
81 # This is used to test specific features or problems with Pod::Text. The
82 # input and output are separated by lines containing only ###.
87 =head1 Test of SE<lt>E<gt>
89 This is S<some whitespace>.
92 This is some whitespace.
97 =head1 I can eat glass
103 Mi povas manĝi vitron, ĝi ne damaĝas min.
107 ⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑
111 मैं काँच खा सकता हूँ और मुझे उससे कोई चोट नहीं पहुंचती.
115 See L<http://www.columbia.edu/kermit/utf8.html>
119 Mi povas manĝi vitron, ĝi ne damaĝas min.
122 ⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑
125 मैं काँच खा सकता हूँ और मुझे उससे कोई चोट नहीं पहुंचती.
127 See <http://www.columbia.edu/kermit/utf8.html>