mysql and MariaDB DBI UserBackend UTF8 encoding
Concerned version
Version: %2.0.5
Platform: (Nginx)
Summary
Variables read out of Maria DB database are not UTF8-encoded
In the Database there is for example "Österreich". The Ö will appear as question mark in the session variable.
Tables, columns in the database are encoded in utf8mb4.
I used dbi:mysql and dbi:MariaDB. Neither worked.
For dbi:mysql I added in the connect command the option to enable utf8mb4:
DBI->connect_cached(
$conf->{dbiAuthChain}, $conf->{dbiAuthUser},
# setting mysql_enable_utf8mb4 does not seem to help
$conf->{dbiAuthPassword}, { RaiseError => 1, mysql_enable_utf8mb4 => 1 }
);
For dbi:MariaDB the change resulted in an error.
When I added the following line before $req->{sessionInfo}->{$var} =$req->data->{entry2}->{$attr}
in NG/Portal/UserDB/DBI.pm it worked correctly
utf8::encode( $req->data->{entry}->{$attr} );
Maybe I am missing something with setting up the configuration. I use the coudot/lemonldap-ng:2.0.5 docker image.
Backends used
Database is MariaDB version 10.3.15.