I'm trying to deal with an old PHP legacy website on one hand and with a new separate section in NodeJS / React on the other hand. They shared the same data, so the same DB.
If I take the User table, the DDL shows this table has utf8 as charset, except for some fields, like the name of the user :
CREATE TABLE `User` (
`id` int(11) NOT NULL AUTO_INCREMENT,
...
`name` varchar(20) CHARACTER SET latin1 NOT NULL,
...
) ENGINE=InnoDB AUTO_INCREMENT=69482 DEFAULT CHARSET=utf8
I don't really know reasons behind this weird config, except maybe that have a link with JSON transactions doesn't accept accentuates characters and our data are in French. But not sure...
Anyway, PHP stores data in UTF8 resulting in mojibake : Noé giving Noé. But getting the same way back, PHP displays it correctly.
Now, comes the NodeJs and Sequelize to fetch data. When I want get the user "Noé", Sequelize fetches Noé and React displays it the same way "Noé".
- What difference there is in the data treatment between PHP and NodeJs ?
- Sequelize does it detect the 'name' column charset in latin1 and so encode data from it to be displayed "correctly" in UTF8 ? There is a way to force it to not do that ?
I'm a bit confused here, thank you for your help :)