1

I'm creating a simple CRUD interface to a database, and I'm trying RapidApp.

I have an existing database, which I connect to with existing Moose-based code. There is a complication in that there is UTF-8 text in the database (eg 'Encyclopédie médico-chirurgicale. Técnicas quirúrgicas. Aparato digestivo')

My Moose-based code works just fine: data goes in & data comes out... and everyone is happy.

In my existing Moose code, the connector is:

$schema = My::Service::Schema->connect( 
      'dbi:Pg:dbname=my_db;host=my.host.name;port=1234',
      'me',
      'secret',
      { pg_enable_utf8 => 1 }
     );

When I set about connecting RapidApp, I first tried a simple rdbic.pl command, but that doesn't pick up the UTF-8 strings. In an attempt to enforce UTF-8-ness, I've created the following:

use Plack::Runner;
use Plack::App::RapidApp::rDbic;
my $cnf = {
    connect_info => {
      dsn      => 'dbi:Pg:dbname=my_db;host=my.host.name;port=1234',
      user     => 'me',
      password => 'secret',
      { pg_enable_utf8 => 1 },
    },
    schema_class     => 'My::Service::Schema'
};
my $App = Plack::App::RapidApp::rDbic->new( $cnf );
my $psgi =  $App->to_app;
my $runner = Plack::Runner->new;
$runner->parse_options('--port', '5678');
$runner->run($psgi);

(which is pretty much rdbic.pl, compressed to one specific thing)

However - I'm getting mal-formed strings (eg: 'Encyclopédie médico-chirurgicale. Técnicas quirúrgicas. Aparato digestivo')

Having fought to get the correct text INTO the database, I know the database is correct... so how do I connect RapidApp to get UTF-8 back out?

CodeGorilla
  • 811
  • 1
  • 6
  • 21

1 Answers1

0

Your schema will need to be configured to support UTF-8. Here's a helpful set of things to try:

How to properly use UTF-8-encoded data from Schema inside Catalyst app?

initself
  • 31
  • 3