mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 20:22:37 +01:00
applets/urban: fix yet another UTF-8 issue
This commit is contained in:
parent
0cd4ce5220
commit
00077e0eef
7
applets/urban
vendored
7
applets/urban
vendored
@ -7,6 +7,7 @@ use warnings;
|
||||
use strict;
|
||||
use utf8;
|
||||
|
||||
use Encode;
|
||||
use WebService::UrbanDictionary;
|
||||
use Getopt::Long qw(GetOptionsFromString);
|
||||
|
||||
@ -20,6 +21,11 @@ local $SIG{__WARN__} = sub {
|
||||
|
||||
my $usage = "Usage: udict [-m <show definition matching this regex>] [-n <entry number>] [-s <up/down (sort by thumbs up/down)>] <phrase>\n";
|
||||
|
||||
binmode(STDOUT, ":utf8");
|
||||
binmode(STDERR, ":utf8");
|
||||
|
||||
@ARGV = map { decode('UTF-8', $_, 1) } @ARGV;
|
||||
|
||||
my ($entry, $sort, $match, $show_all);
|
||||
my $arguments = join(' ', @ARGV);
|
||||
|
||||
@ -34,7 +40,6 @@ my ($ret, $args) = GetOptionsFromString($arguments,
|
||||
print "$getopt_error -- $usage" and exit if defined $getopt_error;
|
||||
print "Missing phrase -- $usage" and exit if @$args == 0 and not $match and not $entry;
|
||||
|
||||
|
||||
if (@$args == 0) {
|
||||
open my $fh, "<", "udict.last";
|
||||
if ($fh) {
|
||||
|
@ -25,8 +25,8 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4630,
|
||||
BUILD_DATE => "2023-03-13",
|
||||
BUILD_REVISION => 4631,
|
||||
BUILD_DATE => "2023-03-19",
|
||||
};
|
||||
|
||||
sub initialize {}
|
||||
|
Loading…
Reference in New Issue
Block a user