storesafe / cordova-sqlite-storage

A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API
Other
2.15k stars 715 forks source link

Sqlite "encoding" problem #649

Closed ghost closed 7 years ago

ghost commented 7 years ago

Heya. First of all I wanna thank you for maintaining this awesome plugin. I'm almost finishing my first Ionic App but still facing some problem when testing it on a Zenfone 2. My DB rows were written in portuguese, and so there is a lot of accentuation. My app seem to work fine on most cellphones but something is going weird when I deploy it on a Asus Zenphone 2 (androd 5.5), as you can see on the screenshots.

I'm using UTF-8 on sqlite. Have you ever faced something like that? Thanks a lot in advance.

anycellphone asuszenfone2

brodycj commented 7 years ago

Hmm. I tested on a Samsung Galaxy J3 with Android 5.1.1 with some multi-byte UTF-8 characters in spec/www/spec/db-tx-string-test.js lines 462-498 OK:


        it(suiteName + 'UTF-8 string test', function(done) {
          if (isWP8) pending('SKIP for WP(8)');

          var db = openDatabase("UTF8-string-test.db", "1.0", "Demo", DEFAULT_SIZE);

          db.transaction(function(tx) {

            tx.executeSql("SELECT UPPER('Test ¢ é €') AS upper_result", [], function(ignored, rs) {
              if (isAndroid && (isWebSql || (isImpl2 && /Android [5-9]/.test(navigator.userAgent))))
                expect(rs.rows.item(0).upper_result).toBe('TEST ¢ É €');
              else
                expect(rs.rows.item(0).upper_result).toBe('TEST ¢ é €');

              // Close (plugin only) & finish:
              (isWebSql) ? done() : db.close(done, done);
            });
          });
        }, MYTIMEOUT);

        it(suiteName + 'UTF-8 string binding test', function(done) {
          if (isWP8) pending('SKIP for WP(8)');

          var db = openDatabase("UTF8-string-binding-test.db", "1.0", "Demo", DEFAULT_SIZE);

          db.transaction(function(tx) {

            tx.executeSql('SELECT UPPER(?) AS upper_result', ['Test ¢ é €'], function(ignored, rs) {
              if (isAndroid && (isWebSql || (isImpl2 && /Android [5-9]/.test(navigator.userAgent))))
                expect(rs.rows.item(0).upper_result).toBe('TEST ¢ É €');
              else
                expect(rs.rows.item(0).upper_result).toBe('TEST ¢ é €');

              // Close (plugin only) & finish:
              (isWebSql) ? done() : db.close(done, done);
            });
          });
        }, MYTIMEOUT);

Can you post a small, self-contained program that demonstrates this issue?

brodycj commented 7 years ago

I have done some additional testing with accented characters with 100% success.

ghost commented 7 years ago

My fault, I was too excited with my success that forgot to reply here. I've just changed the plugin from Cordova-sqlite-evcore-extbuild-free to this version here and everything magically worked with Intel processors.

There is probably a bug with evcore-extbuild-free plugin.

Thank you a lot and I apologize for my delay.

aharslan commented 6 years ago

@brunocollaco i'm using Cordova-sqlite-evcore-extbuild-free and facing the same issue. What branch you ended up using to solve this. I also need JSON queries support (JSON1 extension)

brodycj commented 6 years ago

Cordova-sqlite-evcore-extbuild-free

https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free/issues/19

What branch you ended up using to solve this.

cordova-sqlite-storage (this one) and cordova-sqlite-ext

I also need JSON queries support (JSON1 extension)

Also available in cordova-sqlite-ext

P.S. I would like to add a gentle reminder that the ev*-free plugin versions are available under GPL or commercial license terms. The cordova-sqlite-storage (this one), cordova-sqlite-ext, cordova-sqlite-legacy, and cordova-sqlcipher-adapter plugin versions are available under permissive license terms. For more information about commercial license options please contact sales@litehelpers.net.