http://www.perlmonks.org?node_id=1202951

IB2017 has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

I've been having issues with UNICODE since I started programming in Perl/Windows. Things work, but they mostly require so much adaptation, at least for me. Today I have a new problem I wasn't able to solve: connecting to a SQLite database saved in a directory containing unicode characters. The strange thing is (in my eyes): I am able to create the database without any problem, but I fail to open/access it. In the following (non-sense) script I create 2 databases in two directories (one with and one without unicode characters) and try to access them. Creation is okay for both. Access only for the database in the directory without unicode characters. What I am not understanding?

#!/usr/bin/perl use utf8; use strict; use warnings; use DBI; #first exmple without any unicode in directory my $PathCorpusDB1="a/databaseTest1.db"; print "Creating following database $PathCorpusDB1 ...\n"; my $dbh1 = DBI->connect("dbi:SQLite:$PathCorpusDB1", "", "", { RaiseEr +ror => 1, AutoCommit => 1, PrintError => 1 }); $dbh1->do( "CREATE TABLE data ( ID INTEGER PRIMARY KEY, text, filename +)" ); $dbh1->disconnect; print "Connecting to $PathCorpusDB1\n"; $dbh1 = DBI->connect("dbi:SQLite:$PathCorpusDB1", "", "", { RaiseError + => 1, AutoCommit => 1, PrintError => 1 }); my $AllDbText_ref1 = $dbh1->selectall_arrayref("SELECT filename FROM d +ata"); $dbh1->disconnect; #second example with unicode in directory my $PathCorpusDB2="ü/databaseTest2.db"; print "Creating following database $PathCorpusDB2 ...\n"; my $dbh2 = DBI->connect("dbi:SQLite:$PathCorpusDB2", "", "", { RaiseEr +ror => 1, AutoCommit => 1, PrintError => 1 }); $dbh2->do( "CREATE TABLE data ( ID INTEGER PRIMARY KEY, text, filename +)" ); $dbh2->disconnect; print "Connecting to $PathCorpusDB2\n"; $dbh2 = DBI->connect("dbi:SQLite:$PathCorpusDB2", "", "", { RaiseError + => 1, AutoCommit => 1, PrintError => 1 }); my $AllDbText_ref2 = $dbh2->selectall_arrayref("SELECT filename FROM d +ata"); $dbh2->disconnect;

This is the error message I get

D:\MyModule> perl .\UnicodeDatabaseConnect.pl Creating following database a/databaseTest1.db ... Connecting to a/databaseTest1.db Creating following database ³/databaseTest2.db ... Connecting to ³/databaseTest2.db DBI connect('³/databaseTest2.db','',...) failed: unable to open databa +se file at .\UnicodeDatabaseConnect.pl line 27.