Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks
I am really struggling since days with unicode directory names, for example "Małretuzz" (both Activestate and Strawberry, W7). What is wrong with this?
use utf8; use Win32; $dir="Małretuzz"; print our $short_path_dir = Win32::GetShortPathName( "$dir" );
This gives me a not initialized value.
What I am trying to do is to get a directory name (and path) from a Tk GUI. In this directory I'll create a sqlite database. If the directory contains not english characters...it doesn't work. I've search Perlmonks, I've found suggestions with different Win32s, nothing work here...
use utf8; use Win32; use Tk; use File::Spec; my $dir = File::Spec->canonpath( $mw->chooseDirectory() ); my $short_path_dir=Win32::GetANSIPathName($dir); #alternative #my $short_path_dir = Win32::GetShortPathName( "$dir" ); my $path_and_database="$short_path_dir" . "\\DATABASE\.db"; my $dbh = DBI->connect("dbi:SQLite:$path_and_database","","", {}); $dbh->do( "CREATE TABLE table( ID INTEGER PRIMARY KEY, POS, simple)" ) +; $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: directory unicode
by kcott (Archbishop) on Jun 26, 2013 at 00:43 UTC | |
|
Re: directory unicode ( not Tk->chooseDirectory , Win32::Unicode )
by Anonymous Monk on Jun 26, 2013 at 02:27 UTC |