Reputation: 405
I have some encoding troubles with a string I am sending from the ipcRenderer to ipcMain within the electron framework.
Renderer process:
let test: String = "abc€123";
console.log(test); // prints "abc€123"
electron.ipcRenderer.send('testMessage', test);
Main process:
ipcMain.on('testMessage', (event, arg) => {
console.log(arg); // prints "abcÔé¼123"
});
Why is the main process printing the string as "abcÔé¼123"? The value gets saved into a database and gets saved as garbage and not the actuall € sign.
Edit: console.log("€") in the main process also shows up 'Ôé¼' in the console
Upvotes: 0
Views: 667
Reputation: 405
The problem actually was not the encoding. Turned out to be the datatype i used to save it into sql db.
I use the node-mssql and had to change the datatype to NVarChar:
request.input('test', db.sql.NVarChar, "€");
Upvotes: 0