Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 about the Monastery: (6)
As of 2014-09-21 08:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (168 votes), past polls