Skip Menu |

This queue is for tickets about the CGI-Simple CPAN distribution.

Report information
The Basics
Id: 49671
Status: new
Priority: 0/
Queue: CGI-Simple

People
Owner: Nobody in particular
Requestors: tomas.znamenacek [...] gmail.com
Cc:
AdminCc:

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



Subject: Unicode strings not saved correctly
Test: #!/usr/bin/perl use utf8; use CGI::Simple::Cookie; use Test::More tests => 1; my $string = 'Krůta'; my $cookie = new CGI::Simple::Cookie(-name => 'test', -value => $string); my %thawed = parse CGI::Simple::Cookie($cookie->as_string); is $thawed{'test'}->value, $string, 'Unicode value saved and parsed back correctly.'; Result: 1..1 not ok 1 - Unicode value saved and parsed back correctly. # Failed test 'Unicode value saved and parsed back correctly.' # at test.pl line 10. # got: 'KrFta' # expected: 'Krůta' # Looks like you failed 1 test of 1.
From: tomas.znamenacek [...] gmail.com
For what it’s worth, the problem can be solved by encoding the string: use Encode qw/encode_utf8 decode_utf8/; use MIME::Base64; my $encoded = encode_base64(encode_utf8('Krůta')); my $decoded = decode_utf8(decode_base64($encoded));