commit 3a8b1c9b9529a20915c21c16c2004e5dbde83893
parent af7333093a747a6b9bf6e969664352bbe65348ae
Author: René Wagner <rwagner@rw-net.de>
Date: Sun, 13 Dec 2020 21:43:13 +0100
fix encoding of data files
files for recent/popular must be utf-8 encoded as well.
Diffstat:
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/orrg.pm b/lib/orrg.pm
@@ -44,7 +44,7 @@ sub recent_get
(-f $recentfile) or return undef;
my @recents = ();
- open INFILE, $recentfile;
+ open INFILE, '< :encoding(UTF-8)', $recentfile;
flock INFILE, 1;
while (<INFILE>) {
chomp($_);
@@ -62,7 +62,7 @@ sub recent_add
my $recent = recent_get();
my $newline = "$uri $name";
- open OUTFILE, '>', $recentfile;
+ open OUTFILE, '> :encoding(UTF-8)', $recentfile;
flock OUTFILE, 1;
print OUTFILE "$newline\n";
@@ -83,7 +83,7 @@ sub popular_get
(-f $popularfile) or return undef;
my @populars = ();
- open INFILE, $popularfile;
+ open INFILE, '< :encoding(UTF-8)', $popularfile;
flock INFILE, 1;
while (<INFILE>) {
chomp($_);
@@ -100,7 +100,7 @@ sub popular_add
my ( $uri, $name ) = @_;
my $populars = popular_get();
- open OUTFILE, '>', $popularfile;
+ open OUTFILE, '> :encoding(UTF-8)', $popularfile;
flock OUTFILE, 1;
my $found = 0;
diff --git a/orrg.pl b/orrg.pl
@@ -85,7 +85,6 @@ sub item
$desc =~ s/^\s+\*/*/igm;
$desc =~ s/\s+$//igm;
$desc =~ s/^\s+//igm;
- chomp $desc;
push @item, $desc;
}
$link eq '' or push @item, ('=> '.$link.' open entry in browser', '');