Closed VladimirAlexiev closed 3 months ago
Try using the open
pragma (see https://perldoc.perl.org/open) with the appropriate runes at the top of rdfpuml.pl
, probably
use open ":std", ":utf8";
A better place to look seems to be man perlunicook, specifically prescription 18:
℞ 18: Make all I/O and args default to utf8
$ perl -CSDA ...
or
$ export PERL_UNICODE=SDA
or
use open qw(:std :encoding(UTF-8));
use Encode qw(decode);
@ARGV = map { decode('UTF-8', $_, 1) } @ARGV;
Besides changing how you call the script, you also previously used :encoding(:encoding(UTF-8)
which does strict UTF-8 parsing. You current change to using :utf8
does relaxed parsing.
Please also note that command-line option -CSDL
does not always use UTF-8, but switches encoding based on environment variables (see prescription 16. I recommend to stay with unconditionally using UTF-8 unless you have special needs.
@jonassmedegaard Thanks for the explanation. Closing the issue as there's nothing actionable here.
Currently I run the tool I'm trying to package in https://github.com/rschupp/PAR-Packer/issues/88 like this:
I need the
-C
option otherwise Unicode appearing in input files get mangled.How to pass this option to
pp
. If I try to put it on the first script lineI get error