Skip to content

Instantly share code, notes, and snippets.

@imakado
Created May 28, 2009 12:32
Show Gist options
  • Save imakado/119265 to your computer and use it in GitHub Desktop.
Save imakado/119265 to your computer and use it in GitHub Desktop.
From dc4f49f12a45fc642b779d928522e171e93043a3 Mon Sep 17 00:00:00 2001
From: imakado <imakado@imakado.local>
Date: Thu, 28 May 2009 21:31:16 +0900
Subject: [PATCH] fix encode bug.
---
lib/WebService/SimpleAPI/Wikipedia.pm | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/WebService/SimpleAPI/Wikipedia.pm b/lib/WebService/SimpleAPI/Wikipedia.pm
index 9a6378f..48673be 100644
--- a/lib/WebService/SimpleAPI/Wikipedia.pm
+++ b/lib/WebService/SimpleAPI/Wikipedia.pm
@@ -10,6 +10,8 @@ use LWP::UserAgent;
use Readonly;
use URI;
+use Encode;
+
use base qw( Class::Accessor::Fast );
__PACKAGE__->mk_accessors(qw/ ua /);
@@ -54,7 +56,7 @@ sub _validator {
my($self, $opt) = @_;
for my $key (qw/ keyword q /) {
- utf8::encode($opt->{$key}) if $opt->{$key} and utf8::is_utf8($opt->{$key});
+ Encode::encode_utf8($opt->{$key}) if $opt->{$key} and utf8::is_utf8($opt->{$key});
}
$opt->{keyword} or $opt->{q} or croak 'No parameters was given';
--
1.6.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment