/[Redis.pre-github]/lib/Redis.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Redis.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 69 by dpavlin, Wed Mar 17 18:22:09 2010 UTC revision 71 by dpavlin, Fri Mar 19 14:38:13 2010 UTC
# Line 6  use strict; Line 6  use strict;
6  use IO::Socket::INET;  use IO::Socket::INET;
7  use Data::Dumper;  use Data::Dumper;
8  use Carp qw/confess/;  use Carp qw/confess/;
9    use Encode;
10    
11  =head1 NAME  =head1 NAME
12    
# Line 117  sub AUTOLOAD { Line 118  sub AUTOLOAD {
118          }          }
119    
120          my $result = <$sock> || die "can't read socket: $!";          my $result = <$sock> || die "can't read socket: $!";
121            Encode::_utf8_on($result);
122          warn "<< $result" if $self->{debug};          warn "<< $result" if $self->{debug};
123          my $type = substr($result,0,1);          my $type = substr($result,0,1);
124          $result = substr($result,1,-2);          $result = substr($result,1,-2);
# Line 156  sub __read_bulk { Line 158  sub __read_bulk {
158          my $v;          my $v;
159          if ( $len > 0 ) {          if ( $len > 0 ) {
160                  read($self->{sock}, $v, $len) || die $!;                  read($self->{sock}, $v, $len) || die $!;
161                    Encode::_utf8_on($v);
162                  warn "<< ",Dumper($v),$/ if $self->{debug};                  warn "<< ",Dumper($v),$/ if $self->{debug};
163          }          }
164          my $crlf;          my $crlf;
# Line 369  See also L<Redis::List> for tie interfac Line 372  See also L<Redis::List> for tie interfac
372    
373    my $info_hash = $r->info;    my $info_hash = $r->info;
374    
375    =head1 ENCODING
376    
377    Since Redis knows nothing about encoding, we are forcing utf-8 flag on all data received from Redis.
378    This change is introduced in 1.2001 version.
379    
380    This allows us to round-trip utf-8 encoded characters correctly, but might be problem if you push
381    binary junk into Redis and expect to get it back without utf-8 flag turned on.
382    
383  =head1 AUTHOR  =head1 AUTHOR
384    
385  Dobrica Pavlinusic, C<< <dpavlin at rot13.org> >>  Dobrica Pavlinusic, C<< <dpavlin at rot13.org> >>

Legend:
Removed from v.69  
changed lines
  Added in v.71

  ViewVC Help
Powered by ViewVC 1.1.26