applets/urban: fix yet another UTF-8 issue

This commit is contained in:
Pragmatic Software 2023-03-19 14:23:27 -07:00
parent 0cd4ce5220
commit 00077e0eef
2 changed files with 8 additions and 3 deletions

7
applets/urban vendored
View File

@ -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) {

View File

@ -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 {}