From: Marius Gavrilescu Date: Thu, 29 Jan 2015 07:57:01 +0000 (+0200) Subject: Use Unicode::Normalize X-Git-Tag: 0.001003~2 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=828747ebb9f361b5a6c735e994a6a15ea539efbf;p=poe-component-irc-plugin-hello.git Use Unicode::Normalize --- diff --git a/lib/POE/Component/IRC/Plugin/Hello.pm b/lib/POE/Component/IRC/Plugin/Hello.pm index 75e2f5b..f559fd2 100644 --- a/lib/POE/Component/IRC/Plugin/Hello.pm +++ b/lib/POE/Component/IRC/Plugin/Hello.pm @@ -5,6 +5,7 @@ use strict; use warnings; use utf8; use Encode qw/encode decode/; +use Unicode::Normalize qw/NFC/; our $VERSION = '0.001002'; @@ -43,7 +44,7 @@ sub S_public{ my ($self, $irc, $rfullname, $rchannels, $rmessage) = @_; my $nick = parse_user $$rfullname; my $mynick = $irc->nick_name; - my $message = decode 'UTF-8', $$rmessage; + my $message = NFC decode 'UTF-8', $$rmessage; my @hello = @{$self->{greetings}}; my $match = first { $message =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/i } @hello; diff --git a/t/POE-Component-IRC-Plugin-Hello.t b/t/POE-Component-IRC-Plugin-Hello.t index 526f0bf..edd071e 100644 --- a/t/POE-Component-IRC-Plugin-Hello.t +++ b/t/POE-Component-IRC-Plugin-Hello.t @@ -3,7 +3,7 @@ use v5.14; use strict; use warnings; -use Test::More tests => 18; +use Test::More tests => 19; use Test::MockObject; BEGIN { use_ok('POE::Component::IRC::Plugin::Hello') }; @@ -34,6 +34,7 @@ runtest 'ahoy', 1, 'ahoy'; runtest 'namaste', 1, 'namaste'; runtest 'neaţa', 1, 'neaţa (UTF-8 test)'; runtest 'こんにちは', 1, 'こんにちは (another UTF-8 test)'; +runtest 'neața', 1, 'neața (UTF-8 with combining comma below)'; runtest 'salu', 0, 'salu (misspelling)'; runtest 'hii', 0, 'hii (misspelling)';