Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: DBD::Pg encodes Perlstring to UTF-8 bytes instead of WIN1252 regardless client encoding

by ikegami (Pope)
on Jan 31, 2014 at 17:17 UTC ( #1072881=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Encode qw( is_utf8 encode_utf8 );
    
    is_utf8($string) ? encode_utf8($string) : $string
    
  2. or download this
    use Encode qw( encode_utf8 );
    
    ...
    
    my $sth = ...;
    $sth->execute(encode_utf8($decoded));
    
  3. or download this
    use Encode qw( decode );
    
    ...
    
    my $sth = ...;
    $sth->execute(decode('cp1252', $encoded));
    
  4. or download this
    sub _d { my ($s) = @_; utf8::downgrade($_); $s }
    
    ...
    
    my $sth = ...;
    $sth->execute(_d($encoded));
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1072881]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (20)
As of 2015-07-07 22:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls