From e7df84b3feedb197e85a1b4b9f26bfceae373f18 Mon Sep 17 00:00:00 2001 From: hiratara Date: Sat, 21 Mar 2009 14:51:04 +0900 Subject: [PATCH] fixed bug. --- Changes | 3 +++ README | 2 +- lib/WWW/YahooJapan/KanaAddress.pm | 8 +++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index 33c0fbf..8f084f3 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for WWW-YahooJapan-KanaAddress +0.1.4 Sat, 21 Mar 2009 + fix bug. (Yahoo! side HTML had been changed again.) + 0.1.3 Mon Jan 12 20:30:00 2009 fix bug. (Yahoo! side HTML had been changed.) diff --git a/README b/README index c1ed078..727a5c9 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -WWW-YahooJapan-KanaAddress version 0.1.3 +WWW-YahooJapan-KanaAddress version 0.1.4 INSTALLATION diff --git a/lib/WWW/YahooJapan/KanaAddress.pm b/lib/WWW/YahooJapan/KanaAddress.pm index 8c75f73..dfa5c07 100644 --- a/lib/WWW/YahooJapan/KanaAddress.pm +++ b/lib/WWW/YahooJapan/KanaAddress.pm @@ -6,8 +6,9 @@ use warnings; use strict; use Carp; -use version; our $VERSION = qv('0.1.3'); +use version; our $VERSION = qv('0.1.4'); +use Encode; use LWP::UserAgent; use URI::Escape; @@ -168,9 +169,10 @@ sub _get_kana_dict{ my $ua = $self->{ua}; my $res = $ua->get($url); my $c = $res->content(); + Encode::from_to($c, 'utf8', 'eucJP'); my %ret = (); - while ($c =~ m{]+>
(.+?)
(.+?)}g) { - my ($kana, $kanji) = $self->_strip_tag($1, $2); + while ($c =~ m{]*>.*?]*>(.+?).*?(.+?).*?}g) { + my ($kanji, $kana) = $self->_strip_tag($1, $2); $ret{$kanji} = $kana; } return \%ret;