[DBD::Pg] Add utf-8 test from cpan bug 91655
dbdpg-commits-gENoVmVU/[email protected] Mon, 6 Jan 2014 22:06:21 -0500
| Newsgroups | gmane.comp.db.postgresql.dbdpg.cvs |
|---|---|
| Message-ID | <[email protected]> |
Committed by Greg Sabino Mullane <greg-O9fzpki4YnJWk0Htik3J/[email protected]> Add utf-8 test from cpan bug 91655 --- t/30unicode.t | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/t/30unicode.t b/t/30unicode.t index fc1406a..851326e 100644 --- a/t/30unicode.t +++ b/t/30unicode.t @@ -8,6 +8,7 @@ use 5.006; use strict; use warnings; use utf8; +use charnames ':full'; use Encode; use Test::More; use lib 't','.'; @@ -68,6 +69,11 @@ is ($result, $name, $t); $t = 'Fetching ASCII string from the database returns string with UTF-8 flag off (pg_enable_utf8=0)'; ok (!utf8::is_utf8($result), $t); +my $before = "\N{WHITE SMILING FACE}"; +my ($after) = $dbh->selectrow_array('SELECT ?::text', {}, $before); +is($after, $before, 'string is the same after round trip'); +ok(utf8::is_utf8($after), 'string has utf8 flag set'); + cleanup_database($dbh,'test'); $dbh->disconnect(); -- 1.8.4