Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf-8 encoded german umlaut gets scrambled! #1

Closed
spacepope opened this issue Aug 24, 2017 · 2 comments
Closed

utf-8 encoded german umlaut gets scrambled! #1

spacepope opened this issue Aug 24, 2017 · 2 comments

Comments

@spacepope
Copy link

spacepope commented Aug 24, 2017

Hi,

i am struggling with a huge problem getting special unicode characters (german umlaut) to get read correctly by https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free plugin on Android.

A json gets saved to the SQLite database with the query:

// table created before with:
// CREATE TABLE IF NOT EXISTS "calls" (id PRIMARY KEY, json);

INSERT INTO "calls" SELECT json_extract(json_each.value, '$._id'), json_each.value FROM json_each(json(?));

with the following (shortened) stringifyed json as parameter:

[{"_id":"id-123456","call_description":"Bitte die Prüfung der ortsfesten Anlagen/Geräte gemäß vereinbartem Umfang durchführen"}]

Next the json is selected from the database with the query:

SELECT json FROM "calls" WHERE (json_extract(json, ?) = ?);

with parameters $._id and id-123456 which returns scrambled umlaute:

{"_id":"id-123456","call_description":"Bitte die Pr?ffffffc3??ffffffbc?fung der ortsfesten Anlagen/Ger?ffffffc3??ffffffa4?te gem?ffffffc3??ffffffa4??ffffffc3??ffffff9f? vereinbartem Umfang durchf?ffffffc3??ffffffbc?hren"}

I tried to dive in your native Android drivers implementation because this is not an issue on iOS neither on Windows.
Also when i adb pull the SQLite database to my development machine and look at the inserted columns, the umlauts are displayed correctly, so this probably is more a read than write related problem..
The SQLite DB encoding is UTF-8.

I assume that this is caused somehow by the fancy byte/string transformations done in sqlc.c lines 448ff. I can not debug it and therefore can not propose a fix or solution, neither am i a specialist on UTF-8 encodings.

Maybe this could help?
https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/

It would be great if you can get in touch and see if you can reproduce and hopefully fix this..
If i can supply more info you need or can help somehow, let me know..

Thanks..

@brodybits
Copy link
Collaborator

Closing this one as a duplicate, thanks Hannes for the contribution, further discussion will be in #2. I also raised storesafe/cordova-sqlite-storage-help#35 to track the link you gave (I saw it before, really good).

brodybits pushed a commit that referenced this issue Apr 5, 2018
(unwanted sign extension in conversion)

THANKS to @spacepope (Hannes Petersen <jhpetersen@gmx.de>)
for pointing this one out.

Closes #2

Fixes #1
(marked as duplicate)

(Also reported in storesafe/cordova-sqlite-evcore-extbuild-free#19)
brodybits pushed a commit that referenced this issue Apr 6, 2018
(unwanted sign extension in conversion)

THANKS to @spacepope (Hannes Petersen <jhpetersen@gmx.de>)
for pointing this one out.

- #2
- fixes #1
  (marked as duplicate)
- storesafe/cordova-sqlite-evcore-extbuild-free#19
brodybits pushed a commit to brodybits/cordova-sqlite-evcore-free-dependencies that referenced this issue Apr 11, 2018
brodybits pushed a commit to cbforks/cordova-sqlite-evcore-legacy-ext-common-free-dev that referenced this issue Apr 11, 2018
brodybits pushed a commit to storesafe/cordova-sqlite-evcore-extbuild-free that referenced this issue Apr 12, 2018
(cordova-sqlite-evcore-extbuild-free 0.9.7-pre1)

in included evcore-native-driver.jar for Android

ref:
- #19
- storesafe/android-sqlite-evcore-ndk-driver-free#1
- storesafe/android-sqlite-evcore-ndk-driver-free#2
brodybits pushed a commit to storesafe/cordova-plugin-sqlite-evplus-ext-common-free that referenced this issue Apr 12, 2018
@brodybits
Copy link
Collaborator

Now resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants