Skip to content

Commit 5e044d0

Browse files
committed
fixed utf8 handling for recent versions of perl.
1 parent 730f175 commit 5e044d0

File tree

7 files changed

+18
-13
lines changed

7 files changed

+18
-13
lines changed

ebooks.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ html: $(name).html
2525
%.pdf: $(name).html
2626
cp tutorial-simple.css tutorial.css
2727
ebook-convert $< $@ \
28-
--override-profile-size \
2928
--margin-bottom 10 \
3029
--margin-top 10 \
3130
--margin-left 10 \

utils/gen-html-index-cn.pl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env perl
22

3-
use encoding 'utf8';
3+
use v5.10.1;
4+
use utf8;
45
use strict;
56
use warnings;
67

@@ -85,7 +86,7 @@
8586
$res .= "</ul>\n";
8687

8788
for my $infile (@ARGV) {
88-
open my $in, $infile
89+
open my $in, "<:encoding(utf-8)", $infile
8990
or die "Cannot open $infile for reading: $!\n";
9091
$res .= do { local $/; <$in> };
9192
close $in;
@@ -94,7 +95,7 @@
9495
$res .= "</body></html>";
9596

9697
if ($outfile) {
97-
open my $out, ">:encoding(UTF-8)", $outfile
98+
open my $out, ">:encoding(utf-8)", $outfile
9899
or die "Cannot open $outfile for writing: $!\n";
99100

100101
print $out $res;

utils/gen-html-index-en.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env perl
22

3-
use encoding 'utf8';
3+
use v5.10.1;
4+
use utf8;
45
use strict;
56
use warnings;
67

@@ -91,7 +92,7 @@
9192
$res .= "<section class=\"content\">\n";
9293

9394
for my $infile (@ARGV) {
94-
open my $in, $infile
95+
open my $in, "<:encoding(utf-8)", $infile
9596
or die "Cannot open $infile for reading: $!\n";
9697
$res .= "<article>\n";
9798
my $c = do { local $/; <$in> };

utils/tut2wiki-cn.pl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env perl
22

3+
use v5.10.1;
34
use utf8;
45
use strict;
56
use warnings;
@@ -36,7 +37,7 @@
3637
my $infile = shift or
3738
usage();
3839

39-
open my $in, "<:encoding(UTF-8)", $infile
40+
open my $in, "<:encoding(utf-8)", $infile
4041
or die "cannot open $infile for reading: $!\n";
4142

4243
my $prev;
@@ -76,7 +77,7 @@
7677

7778
utf8::encode($src);
7879

79-
open $in, "<:encoding(UTF-8)", \$src or die $!;
80+
open $in, "<:encoding(utf-8)", \$src or die $!;
8081

8182
my $wiki = '';
8283
undef $prev;
@@ -211,7 +212,7 @@
211212
$wiki =~ s/^\s+|\s+$//sg;
212213

213214
if ($outfile) {
214-
open my $out, ">:encoding(UTF-8)", $outfile
215+
open my $out, ">:encoding(utf-8)", $outfile
215216
or die "Cannot open $outfile for writing: $!\n";
216217

217218
print $out $wiki;

utils/tut2wiki-en.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env perl
22

3+
use v5.10.1;
4+
use utf8;
35
use strict;
46
use warnings;
5-
use encoding 'utf8';
67

78
use Getopt::Std;
89
my %opts;

utils/wiki2html-cn.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env perl
22

3+
use v5.10.1;
34
use utf8;
45
use strict;
56
use warnings;
@@ -44,7 +45,7 @@
4445
die "Bad input file $infile\n";
4546
}
4647

47-
open my $in, "<:encoding(UTF-8)", $infile
48+
open my $in, "<:encoding(utf-8)", $infile
4849
or die "Cannot open $infile for reading: $!\n";
4950

5051
my $ctx = {};
@@ -96,7 +97,7 @@
9697
#$html .= " </body>\n</html>\n";
9798

9899
if ($outfile) {
99-
open my $out, ">:encoding(UTF-8)", $outfile
100+
open my $out, ">:encoding(utf-8)", $outfile
100101
or die "Cannot open $outfile for writing: $!\n";
101102

102103
print $out $html;

utils/wiki2html-en.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env perl
22

3-
use encoding 'utf8';
3+
use v5.10.1;
4+
use utf8;
45
use strict;
56
use warnings;
67

0 commit comments

Comments
 (0)