Sorting with DBD::SQLite and Mac OS X
At least in my Mac OS X (Leopard) the perllocale and the perl collations that DBD::SQLite make available do not work to properly sort UTF. Or that, or I am doing something wrong. Nevertheless, I found a simple way to do that, thanks to the Unicode::Collate module. Just add a few lines of code after you open your database connection:
my $collator = Unicode::Collate->new(); $DBD::SQLite::COLLATION{mine} = sub { $collator->cmp(@_) };
and then use the mine collation:
$sth = $dbh->prepare("SELECT * FROM somewhere ORDER BY key COLLAT…