added use bytes to support utf-8 encoded strings
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 17 Mar 2010 18:22:09 +0000 (18:22 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 17 Mar 2010 18:22:09 +0000 (18:22 +0000)
We are not round-tripping utf-8 encoding strings correctly in
this version. We will get string back wothout perl utf-8 flag

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/Redis@69 447b33ff-793d-4489-8442-9bea7d161be5

lib/Redis.pm
t/01-Redis.t

index 3cc595e..6a6aab3 100644 (file)
@@ -77,6 +77,8 @@ our $AUTOLOAD;
 sub AUTOLOAD {
        my $self = shift;
 
+       use bytes;
+
        my $sock = $self->{sock} || die "no server connected";
 
        my $command = $AUTOLOAD;
index a54d88c..756135a 100755 (executable)
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
-use Test::More tests => 108;
+use Test::More tests => 110;
 use Data::Dumper;
 
 use lib 'lib';
@@ -30,6 +30,10 @@ ok( $o->set( foo => 'baz' ), 'set foo => baz' );
 
 cmp_ok( $o->get( 'foo' ), 'eq', 'baz', 'get foo = baz' );
 
+my $euro = "\x{20ac}";
+ok( $o->set( utf8 => $euro ), 'set utf8' );
+cmp_ok( $o->get( 'utf8' ), 'eq', $euro, 'get utf8' );
+
 ok( $o->set( 'test-undef' => 42 ), 'set test-undef' );
 ok( $o->set( 'test-undef' => undef ), 'set undef' );
 ok( ! defined $o->get( 'test-undef' ), 'get undef' );