Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8779773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:52:55+00:00 2026-06-13T19:52:55+00:00

I have a MySQL ‘articles’ table and I am trying to make the following

  • 0

I have a MySQL ‘articles’ table and I am trying to make the following insert using SQLyog.

insert into articles (id,title) values (2356606,'Jérôme_Lejeune');

This works fine and the data shows fine when I do a select query.

The problem is that when I do the same insert query through my perl script, the name shows up with some junk characters in place of é and ô in the database. I need to know how to properly store the name through my script. The part of code that does the insert is like this.

$sql_insert = "insert into articles (id,title) values (?,?)";
$sth_insert = $dbh->prepare($sql_insert);
$sth_insert->execute($id,$title);

$id and $title have the correct required data which I have checked by print before I am inserting them. Please assist.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:52:57+00:00Added an answer on June 13, 2026 at 7:52 pm

    There are few things to follow.

    First you have to make sure, that Perl understands that data which is moving between your program and DB is encoded as UTF-8 (i expect your databases and tables are set properly). For this you need to say it loud out on connecting to database, like this:

     my($dbh) = DBI->connect(
         'dbi:mysql:test',
         'user',
         'password',
         {
             mysql_enable_utf8 => 1,
         }      
    );
    

    Next, you need send data to output and you must set it to decaode data as UTF-8. For this i like pretty good module:

    use utf8::all;
    

    But this module is not in core, so you may want to set it with binmode yourself too:

    binmode STDIN, ":utf8"; 
    binmode STDOUT, ":utf8"; 
    

    And if you deal with webpages, you have to make sure, that browser understoods that you are sending your data encoded as UTF-8. For that you should make sure your HTTP-headers include encoding:

    Content-Type: text/html; charset=utf-8;
    

    and set it with HTML META-tag too:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    

    Now you should get your road covered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have mysql code for input data: $sql = INSERT IGNORE INTO inspection_report ;
I have created a mysql table with the following columns... item_price, discount, delivery_charge, grand_total
I have mysql table 'files'. which contains following order. 1. id 2.filename 3.keywords When
I have MySQL table with the following structure: +---------+--------------+------+-----+---------+----------------+ | Field | Type |
I have mysql database with following table... | id | amount | tax |
I have mysql table with the following structure. All records are static and only
I have mysql table Stop_Times with 20 Million records. I am using MyISAM storage
I have MySQL InnoDB table utf-8 encoded. This table has only id and name
I have mysql table that has a column that stores xml as a string.
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.