I am trying to retrieve some data from a MySQL database (version 5.5.35) using the mysql
npm module in NodeJS (14.5.0).
1.) Here are the database's character set variables:
2.) Server's encoding:
3.) Here are the settings of the table I am fetching data from:
4.) Here is how I am initiating the connection:
const mysql = require('mysql');
const dbConfig = require('../../config/database.json');
dbConfig.connectionLimit = 10;
dbConfig.charset = 'utf8' // tried latin1, latin2 and utf8mb4
console.log(dbConfig);
const connection = mysql.createPool(dbConfig);
module.exports = connection;
5.) Here's the result wihtout any conversion:
That field's value should be Cieśliński
.
That field's value right now is Cieœliñski
.
6.) Here's the result when I set dbConfig.charset
to different encodings:
latin1:
Cie�li�ski
.latin1, then conversion from latin1 to utf8 with
Iconv
:Cie�li�ski
.utf8: Cieœliñski
utf8, then conversion from latin1 to utf8 with
Iconv
:Cieœliñski
.
Proper value should be: Cieśliński
.
Question: How should I set up my NodeJS server to properly fetch the proper value of the field? (Cieśliński
)