SQLite Forum

Unicode and CLI for Mac
Login
As mentioned in the Topic header I'm on a Mac running High Sierra. 
Perl: This is perl 5, version 18, subversion 2 (v5.18.2)

My scripts now have the following added:
<code>
use 5.012; # https://perldoc.perl.org/perluniintro
use Encode qw(encode decode);
binmode(STDOUT, "encoding(UTF-8)");
use open ":std", ":encoding(UTF-8)";
</code>
When doing a select:
<code>
$sth=$dbh->prepare(qq{select name,title,genre,cds.artistid,cdid from cds join artists on artists.artistid=cds.artistid order by cds.id desc limit 5;});
     $sth->execute();
     while (@records=$sth->fetchrow_array()) {
		$ArtistName=decode('UTF-8',$records[0]);
.
.
     }
     $sth->finish();

</code>
And when adding or updating:
<code>
$text=encode('UTF-8',("Ali Farka Touré & Toumani Diabaté"));
$sth=$dbh->do(qq{update artists set name=("$text") where artistid=1373}); 
</code>

I believe you are right in thinking I don't need ICU. But in response to another reply, it doesn't seem my console is UTF-8 compatible.

"What is the output of SELECT x'c3a1', hex('á'); " came back empty.
And a select with CLI:
<code>
sqlite> select name from artists where artistid in(1373,1786,1558,1653,1771);
Ali Farka Touré & Toumani Diabaté
Dvořák,A.
Dvořák,Elgar
Eilertsen,Fraanje,Strønen
Café del Mar
</code>

I do have the DB updated but had to do it all via Perl.