Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 taking refuge in the Monastery: (5)
As of 2014-11-28 04:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (193 votes), past polls