From 00077e0eefa2071479796b276fcda8ac09b1f0ee Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 19 Mar 2023 14:23:27 -0700 Subject: [PATCH] applets/urban: fix yet another UTF-8 issue --- applets/urban | 7 ++++++- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/applets/urban b/applets/urban index 3583a361..9154f54b 100755 --- a/applets/urban +++ b/applets/urban @@ -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 ] [-n ] [-s ] \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) { diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 7f1756d3..c077dec1 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -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 {}