Skip Menu |

This queue is for tickets about the WebService-MusicBrainz CPAN distribution.

Report information
The Basics
Id: 50054
Status: resolved
Priority: 0/
Queue: WebService-MusicBrainz

People
Owner: bfaist [...] cpan.org
Requestors: cpan.org [...] mavit.org.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.22
Fixed in: (no value)



Subject: Can't escape \x{nnnn}, try uri_escape_utf8() instead at /.../WebService/MusicBrainz/Query.pm line 152
When searching for an artist using a UTF-8 encoded name, WebService::MusicBrainz::Artist::search fails. See the attached patch for a test and a fix.
Subject: WebService-MusicBrainz-utf8.patch
diff -ur WebService-MusicBrainz-0.22-aglwIo/lib/WebService/MusicBrainz/Query.pm WebService-MusicBrainz-0.22-a7CrQ2/lib/WebService/MusicBrainz/Query.pm --- WebService-MusicBrainz-0.22-aglwIo/lib/WebService/MusicBrainz/Query.pm 2009-04-26 04:49:12.000000000 +0100 +++ WebService-MusicBrainz-0.22-a7CrQ2/lib/WebService/MusicBrainz/Query.pm 2009-09-28 00:23:42.000000000 +0100 @@ -149,7 +149,7 @@ my @new_terms; foreach my $term (split /[\s\+,]/, $params->{$key}) { - push @new_terms, URI::Escape::uri_escape($term); + push @new_terms, URI::Escape::uri_escape_utf8($term); } $params->{$key} = join '+', @new_terms; diff -ur WebService-MusicBrainz-0.22-aglwIo/t/Artist.t WebService-MusicBrainz-0.22-a7CrQ2/t/Artist.t --- WebService-MusicBrainz-0.22-aglwIo/t/Artist.t 2009-04-26 04:49:12.000000000 +0100 +++ WebService-MusicBrainz-0.22-a7CrQ2/t/Artist.t 2009-09-28 00:24:32.000000000 +0100 @@ -5,7 +5,8 @@ # change 'tests => 1' to 'tests => last_test_to_print'; -use Test::More tests => 61; +use utf8; +use Test::More tests => 62; BEGIN { use_ok('WebService::MusicBrainz::Artist') }; ######################### @@ -53,6 +54,9 @@ my $artist_name2 = $search_name2->artist(); ok( $artist_name2->score() =~ m/\d+/, 'get first artist score of 100' ); +my $search_name_utf8 = $ws->search({ NAME => 'ザ・リリーズ' }); +ok( $search_name_utf8, 'get NAME search response object when NAME is UTF-8 encoded' ); + sleep($sleep_duration); #### TEST ARTIST NAME SEARCH ###############################
Patch applied to version 0.90. Thanks for the patch.