#!/usr/bin/perl -w

use DBI;

my $dsn = "DBI:Pg:dbname=junk;host=localhost";  # change database name
my ($user, $password) = ('olly', ''); # must be modified

my $dbh = DBI->connect($dsn, $user, $password,
		       { PrintError => 1, 
			 RaiseError => 1, 
			 AutoCommit => 1 });

my $sth = $dbh->prepare("select upper(?)");

my $test = "\xc3\xb6"; # lowercase o with diaeresis in utf-8, u+00f6

$sth->execute($test);
my $result = ($sth->fetchrow_array)[0];

if($result ne "\xc3\x96") { # uppercase O with diaeresis, u+00d6
    print "Result $result is wrong\n";
}

$sth->finish;
$dbh->disconnect;
