Skip Menu |
 

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 8725
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: DANKOGAI [...] cpan.org
Requestors: GAAS [...] cpan.org
Cc:
AdminCc:

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



Subject: Can't encode URI
Download (untitled) / with headers
text/plain 569b
There is a test in encode/decode that make it return undef if you try to pass a reference as the string to process. This seems like a bad idea. It will for instance prevent passing objects that do stringify overloading. $ perl -MURI -MEncode -le 'print encode("utf-8", URI->new("http://foo"))' $ perl -MURI -MEncode -le 'print encode("utf-8", URI->new("http://foo") . "")' http://foo I want these both to return the same thing. Just stringify whatever is passed in and process that. A croak might be in order if RETURN_ON_ERR is passed in CHECK.
Download (untitled) / with headers
text/plain 866b
The patch below should fix that. Thanks for your remark. Dan the Encode Maintainer --- Encode.pm 2004/10/24 12:32:06 2.8 +++ Encode.pm 2004/12/03 17:06:59 @@ -1,5 +1,5 @@ # -# $Id: Encode.pm,v 2.8 2004/10/24 12:32:06 dankogai Exp dankogai $ +# $Id: Encode.pm,v 2.8 2004/10/24 12:32:06 dankogai Exp $ # package Encode; use strict; @@ -140,7 +140,7 @@ { my ($name, $string, $check) = @_; return undef unless defined $string; - return undef if ref $string; + $string .= '' if ref $string; # stringify; $check ||=0; my $enc = find_encoding($name); unless(defined $enc){ @@ -156,7 +156,7 @@ { my ($name,$octets,$check) = @_; return undef unless defined $octets; - return undef if ref $octets; + $string .= '' if ref $octets; $check ||=0; my $enc = find_encoding($name); unless(defined $enc){


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.