Changeset 820

Show
Ignore:
Timestamp:
08/29/09 01:57:27 (3 months ago)
Author:
athomason
Message:

The key reconstituted from server by get_multi won't have utf8 on, so turn it off on input scalar to allow hash lookup to succeed.

Location:
trunk/api/perl
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/api/perl/lib/Cache/Memcached.pm

    r818 r820  
    1919use Errno qw( EINPROGRESS EWOULDBLOCK EISCONN ); 
    2020use Cache::Memcached::GetParser; 
     21use Encode (); 
    2122use fields qw{ 
    2223    debug no_rehash stats compress_threshold compress_enable stat_callback 
     
    548549    my $r = $self->get_multi($key); 
    549550    my $kval = ref $key ? $key->[1] : $key; 
     551 
     552    # key reconstituted from server won't have utf8 on, so turn it off on input 
     553    # scalar to allow hash lookup to succeed 
     554    Encode::_utf8_off($kval) if Encode::is_utf8($kval); 
     555 
    550556    return $r->{$kval}; 
    551557}