1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
commit 60bb7f82a913fc132de2ec4be3ac1f5c0184ebcb
Author: Jonas Smedegaard <dr@jones.dk>
Date: Tue Dec 4 22:26:15 2018 +0100
Consistently use UTF-8 encoding, strictly.
The open pragma :encoding(UTF-8) refuses to use data that fails to parse
strictly as UTF-8 (the pragma :utf8 sloppily warns on decoding errors).
The open pragma :std renders explicit declarations
for STDIN, STDOUT and STDERR superfluous.
--- a/bin/DEPRECATED/rdf2ontorefine.pl
+++ b/bin/DEPRECATED/rdf2ontorefine.pl
@@ -3,6 +3,7 @@
use strict;
use warnings;
use utf8;
+use open qw(:std :encoding(UTF-8));
our @where; # Array of WHERE strings, since order of binds matters:
# [0] OntoRefine prebinds
--- a/bin/DEPRECATED/rdf2tarql.pl
+++ b/bin/DEPRECATED/rdf2tarql.pl
@@ -3,6 +3,7 @@
use strict;
use warnings;
use utf8;
+use open qw(:std :encoding(UTF-8));
our $construct = "";
our $where = "";
--- a/bin/rdf2sparql.pl
+++ b/bin/rdf2sparql.pl
@@ -3,6 +3,7 @@
use strict;
use warnings;
use utf8;
+use open qw(:std :encoding(UTF-8));
our $tool = "ontorefine";
our $form = "update";
--- a/bin/rdfpuml-InlineClassWithLabel.pl
+++ b/bin/rdfpuml-InlineClassWithLabel.pl
@@ -19,8 +19,8 @@
use strict;
use warnings;
use utf8; # Unicode chars below
+use open qw(:std :encoding(UTF-8));
-use Encode;
use Carp::Always; # http://search.cpan.org/~ferreira/Carp-Always-0.13/lib/Carp/Always.pm
# stronger than $Carp::Verbose = 1;
use RDF::Trine;
@@ -101,10 +101,9 @@
my $prefixes = -e "prefixes.ttl" ? slurp("prefixes.ttl") : "";
my $file = slurp("$fname.ttl");
-my $turtle = decode_utf8 "$PREFIXES_TURTLE\n$prefixes\n$file";
-my $prefixes_all = decode_utf8 "$PREFIXES_TURTLE\n$prefixes";
-open (STDOUT, ">:encoding(UTF-8)", "$fname.puml") or die "can't create $fname.puml: $!\n";
-binmode STDERR, ":encoding(UTF-8)";
+my $turtle = "$PREFIXES_TURTLE\n$prefixes\n$file";
+my $prefixes_all = "$PREFIXES_TURTLE\n$prefixes";
+open (STDOUT, ">", "$fname.puml") or die "can't create $fname.puml: $!\n";
#print STDERR $turtle; die;
my $store = RDF::Trine::Store::Memory->new();
--- a/bin/rdfpuml.pl
+++ b/bin/rdfpuml.pl
@@ -3,7 +3,7 @@
use strict;
use warnings;
use utf8; # Unicode chars in the source below
-use open ":std", ":utf8"; # instead of -C, see https://github.com/rschupp/PAR-Packer/issues/89
+use open qw(:std :encoding(UTF-8)); # instead of -C, see https://github.com/rschupp/PAR-Packer/issues/89
# use Encode; # decode_utf8
# use Carp::Always; # http://search.cpan.org/~ferreira/Carp-Always-0.13/lib/Carp/Always.pm
@@ -93,8 +93,7 @@
my $data = slurp($infile);
my $turtle = "$PREFIXES_TURTLE\n$prefixes\n$data";
my $prefixes_all = "$PREFIXES_TURTLE\n$prefixes";
-open STDOUT, '>:encoding(UTF-8)', $outfile or die "can't create $outfile: $!\n";
-binmode STDERR, ":encoding(UTF-8)";
+open STDOUT, '>', $outfile or die "can't create $outfile: $!\n";
# print STDERR $turtle; die;
my $store = RDF::Trine::Store::Memory->new();
@@ -121,7 +120,7 @@
sub slurp {
my $file = shift;
- open my $fh, '<:encoding(UTF-8)', $file or die "Can't open $file: $!\n";
+ open my $fh, '<', $file or die "Can't open $file: $!\n";
local $/ = undef;
<$fh>
}
--- a/lib/RDF/Prefixes/Curie.pm
+++ b/lib/RDF/Prefixes/Curie.pm
@@ -12,6 +12,7 @@
use strict;
use warnings;
use utf8;
+use open qw(:std :encoding(UTF-8));
BEGIN {
$RDF::Prefixes::Curie::AUTHORITY = 'cpan:VALEXIEV';
@@ -168,7 +169,9 @@
=head2 Internationalisation
Strings passed to and from this module are expected to be utf8 character
-strings, not byte strings. URIs containing non-Latin characters should "just work".
+strings, not byte strings,
+and file handles are expected to reference UTF8-encoded content.
+URIs containing non-Latin characters should "just work".
=head1 BUGS
|