Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

342
Vistas
How to read Chinese text from a database using DBI?

I have a database with a list of articles in Chinese and I'm having a problem when I try to do my query to get all the articles names, all I see is ??? and not the Chinese text.

my $db_connection = DBI->connect("DBI:mysql:host=localhost;database=articles", 'root', ''); 
my $con  = $db_connection->prepare( "select * from articles" );

$con->execute;

while (my $infoD = $con->fetchrow_hashref())
{
    $INFO{$infoD->{name}} .=   decode('utf8', $infoD->{name});  
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

declare in your connection string also that it should use utf8

DBI->connect("DBI:mysql:host=localhost;database=articles", 'root', '',{mysql_enable_utf8 => 1}); 

If you have utf8mb4

you have to replace {mysql_enable_utf8 => 1} with {mysql_enable_utf8mb4 => 1}

Edit:

also see here UTF8 all the way

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda