jxcore / jxcore-cordova

JXcore / Node.JS plugin for Apache Cordova / PhoneGap
Other
233 stars 68 forks source link

SQLite select, not UTF8 encoding #107

Open voxsoftware opened 8 years ago

voxsoftware commented 8 years ago

I write a SQLITE Database, i push rows with string fields in UTF8, but I made SELECT, I get the values in unknown encoding

Example:

db.run("insert into tabla(str) values('ちは')", function(){
   db.all("select str from tabla", function(err, rows){
         var str= rows[0].str; // I get:   ちは   instead of ちは
   })
})
ktrzeciaknubisa commented 8 years ago

Yeap, I see this too on desktop jx SM (V8 works ok):

var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database(':memory:');

db.serialize(function () {

  db.run("CREATE TABLE tabla (str TEXT)");
  db.run("insert into tabla(str) values('ちは')", function (err) {
    db.get("select str from tabla", function (err, row) {
      console.log(row.str);
    })
  })
});
$ jxsm test.js 
ちは
$ jxv8 test.js 
ちは
obastemur commented 8 years ago

Is this still a case with latest 0.3.10 ?

ktrzeciaknubisa commented 8 years ago

Yes. Just checked with latest build.