www.fromthevalley.com.au

Postgres Encoding Errors

ERROR: 

  DBD::Pg::st execute failed: ERROR:  invalid byte sequence for encoding "UTF8": 0x93
 
SOLUTION:
  
use utf8; 
use Encode; 
my $possibly_bad_utf8_data = get_data(); 
my $good_data = encode( "UTF-8", $possibly_bad_utf8_data ); 

The capitalization of the UTF-8 in the call to encode() is important, it tells encode to be "strict" about the UTF-8. It turns out use utf8; isn't 100% strict and hence can't be inserted into a strict mode PostgreSQL database.

HOMEAJAXAPACHEBizphoneCSSDNSGeneralGraphicsHTMLHardwareJavascriptLinuxMACMS SQLMailMicrosoftOFFICE 365PerlPostgresSEOSocial MediaVMwareWindows 10