in reply to Oddities in UTF-8 and DBD::Pg?

Hmmm, what happens when you add use utf8; to your program?

Replies are listed 'Best First'.
Re^2: Oddities in UTF-8 and DBD::Pg?
by Anonymous Monk on Jun 28, 2015 at 07:35 UTC
    Okay, I changed 2 things. use utf8; at the start. And i fixed the error in line 36:
    print "$testname failed on psql readback. Got $resulttest2 where $test + was expected.\n";
    Now I get this, which I must admit, looks better:
    ... test2 is successful on DBI readback. psql raw results: <table border="1"> <tr> <th align="center">test</th> </tr> <tr valign="top"> <td align="left">äöüßÄÖÜ</td> </tr> </table> <p>(1 Zeile)<br /> </p> test2 failed on psql readback. Got äöüßÄÖÜ where &#65533;&#65533;&#655 +33;&#65533;&#65533;&#65533;&#65533; was expected.
    I don't understand why I get the question marks in the variable test, but my problem seems to be fixed. Many thanks. I was missing the obvious it seems. ;o)
      I don't understand why I get the question marks in the variable test, but my problem seems to be fixed.
      The output of backticks should also be decoded before comparing with unicode strings. I think use open qw( :encoding(utf-8) :std ); does that, and also switches stdout to utf-8 mode (stdout being in binary mode is probably what causes 'question marks').