It took me about three hours to figure out something this simple, so I’m posting this here!
If you’re doing ajax stuff with CGI.pm in perl, you’ll want to exchange your data in UTF8, to do so you need only one special line of code*:
my $json = decode utf8=>$q->param('json');
This will make perl work natively in UTF8 with
If you want to put this (or part of it) in a database, you don’t need to do anything special because the DBD driver will convert your string from UTF8 to the database encoding (UCS-2 in my case).
*Of course, you’ll also need to