One Star

Wrong character encoding in mysql result using characterSetResults prp

Hi,
I've problem with tMysqlConnection. Data in the databse are stored in latin1 so I need to set up jdbc connector to use this character set. Unfortunately setting up tMysqlConnection Additional JDBC Parameters to "characterSetResults=CP1252" (latin1, iso8859_1) does not affect output.
When I connect on the server and use following connection command everything goes right:
mysql -p pc --default-character-set=latin1
mysql> select last_name from candidate where candidate_id=3;
+-------------+
| last_name |
+-------------+
| Ková?ová |

Same when I'm connecting with MySQL workbench:
SET character_set_results = latin1;
SELECT last_name FROM `pc`.`candidate` where candidate_id=3;

Is there a way to run "SET character_set_results = latin1"; command before any future select? Or is there way to make connection right?
2 REPLIES
Community Manager

Re: Wrong character encoding in mysql result using characterSetResults prp

Hi
1. Append this parameter useUnicode=true&characterEncoding=xxx into tMysqlConnection Additional JDBC Parameters.
or
2. Use a tMysqlRow to execute statement ""SET character_set_results = xxx" before any future select, eg:
tMysqlConnnection
|
onsubjobok
|
tMysqlRow
|
onsubjobok
|
tMysqlInput--main-->tLogRow
|
onsubjobok
|
tMysqlCommit
on tMysqlRow, check the box' use an existing connection'
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Wrong character encoding in mysql result using characterSetResults prp

Hi,
I am using talend v 5.3, I have followed all the steps mentioned below.
i.e. added "useUnicode=true&characterEncoding=UTF-8" in the additional parameter of the mysql connection.
also tried "SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'" in the mysql row component but I am still facing this problem.
I was trying to use the traces debug and found that the strings are not getting converted to UTF-8 format.
Is this a problem in the v5.3 or have I missed anything in the above statements. Please check the attached images.
Regards,
Saabir