Subject: | _message_encode fails if input is already uft8 |
Date: | Wed, 18 Jun 2014 11:03:23 +0100 |
To: | <bug-Net-APNS [...] rt.cpan.org> |
From: | Raymond Field <raymond.field [...] mvine.com> |
"decode"ing to utf8 an already utf8 enabled string produces garbage:
use utf8;
my $string = "£"; # UK pound symbol, hex = a3
print encode( 'unicode', decode( 'utf8', $string ) );
prints garbage (i.e. black diamond with a question mark)
proposed change to Net::APNS::Notification:
sub _message_encode {
my $self = shift;
return encode( 'unicode', is_utf8($self->message)?$self->message:decode(
'utf8', $self->message ) );
}
returns £ as expected.