node-mariasql icon indicating copy to clipboard operation
node-mariasql copied to clipboard

Issues with Charset

Open kaliseo opened this issue 8 years ago • 5 comments

Hi,

Don't understand why got this problem. Data are stored in utf8_bin in database. When i query with node, got special chars instead of accentued ones.

no problems quering with another client got correct chars.

Impossible to get correct encoding characters while quering with mariasql node client.

That's bad cause ont functionality i like is to use objects with queries in data injection.

kaliseo avatar Aug 09 '16 12:08 kaliseo

The connection charset is wrong. You can work around it by sending SET NAMES 'utf8' upon connecting. I think this should be done properly by the library, though.

Cytlan avatar Aug 19 '16 07:08 Cytlan

I attempt to do lot of things, SET NAMES 'utf8' doesn't change Anything.

I replaced the node MariaSQL client with Mysql Node client, and everything worked properly. So sad.

kaliseo avatar Aug 19 '16 08:08 kaliseo

i had issues with persian characters, result only show "?" as every characters after couple of hours, it's solved before executing any queries , i run SET NAMES 'utf8' ,

c.query('SET NAMES \'utf8\'', function (err, rows) { if (err) throw err; console.dir(rows); });

c.query('select * from chert', function (err, rows) { if (err) throw err; console.dir(rows); });

ali-khabbaz avatar Nov 17 '16 17:11 ali-khabbaz

@ali-khabbaz ohhhh.... good solution, but this is not efficient for big cluster (~5,000,000 records).

hosseinGanjyar avatar Apr 05 '18 14:04 hosseinGanjyar

This works too

var c = new Client({
  charset: 'utf8',
})

teemujonkkari avatar Jan 07 '19 12:01 teemujonkkari