My ancient mysql database (mysql 5.0.2) is in latin1 format and I'm encountering an issue with getting data from it. Non-ascii characters such as Â, À, and Á are appearing as 'ef bf bd' in hex, which means different characters are being displayed the same way.
I need assistance in retrieving these characters correctly so I can match each one to its corresponding utf-8 character.
I've attempted changing the charset, but unfortunately, it has not resolved the problem for me!
Could someone please assist me in extracting meaningful data?
var mysql = require('mysql')
var con = mysql.createConnection({
host: "localhost",
user: "root",
//charset: "utf8mb4",
//charset: "utf8",
charset: "latin1",
database : 'my_db'
})
con.connect()
var query = con.query("SELECT data from my_table where id='07'", function
(error, results, fields) {
var b = Buffer.from (results[0].data)
console.log ('Retrieved data in hex -> ', b)
})
con.end()
Whenever I update the data in the database to contain only ascii characters, I can successfully retrieve the information in JavaScript without any issues. However, when I substitute this data with characters like 'á' or 'à', I consistently receive 'ef bf bd' in hex (-17 -65 -67 in decimal).