xsawyerx / metacpan-api

A comprehensive, DWIM-featured API to MetaCPAN
http://search.metacpan.org
14 stars 14 forks source link

Encoding of author name getting corrupted [rt.cpan.org #74643] #23

Closed xsawyerx closed 9 years ago

xsawyerx commented 9 years ago

https://rt.cpan.org/Ticket/Display.html?id=74643

Hi Sawyer,

The encoding of the author name field is getting munged when I get it via MetaCPAN::API.
I get the name using the API:

  my $id     = 'JWALT';
  my $mcpan  = MetaCPAN::API->new();
  my $info   = $mcpan->author($id);
  my $name   = $info->{name};

If I make the request to MetaCPAN myself:

  my $uri = 'http://api.metacpan.org/author/JWALT';
  my $tiny = HTTP::Tiny->new();
  $result = $tiny->get($uri);

If I put the name out of $result->{content} then I get a UTF-8 encoded version of
the author's name. But I don't get a UTF-8 encoded name from MetaCPAN::API
eserte commented 9 years ago

I dont't think this is still an issue. The following tests deliver expected results:

$ perl5.18.4 -MMetaCPAN::API -MDevel::Peek -e 'warn $MetaCPAN::API::VERSION; my $id = q{SREZIC}; my $mcpan = MetaCPAN::API->new(); my $info = $mcpan->author($id); my $name = $info->{name}; Dump $name'
0.44 at -e line 1.
SV = PV(0x225da80) at 0x21c12e8
  REFCNT = 1
  FLAGS = (PADMY,POK,pPOK,UTF8)
  PV = 0x228bb40 "Slaven Rezi\304\207"\0 [UTF8 "Slaven Rezi\x{107}"]
  CUR = 13
  LEN = 16

$ perl5.18.4 -MMetaCPAN::API -MDevel::Peek -e 'warn $MetaCPAN::API::VERSION; my $id = q{JWALT}; my $mcpan = MetaCPAN::API->new(); my $info = $mcpan->author($id); my $name = $info->{name}; Dump $name'
0.44 at -e line 1.
SV = PV(0x271f670) at 0x2663258
  REFCNT = 1
  FLAGS = (PADMY,POK,pPOK,UTF8)
  PV = 0x270ceb0 "J\303\266rg Walter"\0 [UTF8 "J\x{f6}rg Walter"]
  CUR = 12
  LEN = 16
xsawyerx commented 9 years ago

@eserte++ Thank you for verifying this! :)