Skip to content

Commit

Permalink
fix: add reference comments, test U+0131, etc.
Browse files Browse the repository at this point in the history
to code & documentation

- add references for EU character mappings
  - mobilexag/cordova-sqlite-evplus-ext-free#21
  - storesafe/cordova-sqlite-evcore-extbuild-free#50 (comment)
- add reference to cordova-sqlite-storage test suite from:
  - https://github.com/storesafe/cordova-sqlite-storage/tree/6.0.0/spec
- add reference to:
  - https://www.compart.com/en/unicode/U+0131
- test one-way U+0131 (`ı`) -> capital I
- update reproduction & documentation of known issue with
  U+0131 (`ı`) & capital I
  • Loading branch information
brodycj committed Jun 10, 2022
1 parent f6a5892 commit cc5c710
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ int main() {
- `cc test.c sqlite3.c sqlite3_eu.c -o test`
- `./test`
## Known quirks
## Known mapping issue
`SELECT LOWER_EU('I')` gives a result with U+0131 (`ı`)
Here is a manifestation, based on the cordova-sqlite-storage test suite:
- Statements such as `SELECT LOWER_EU(9e999)` return results like `ınf`
## References
- https://github.com/mobilexag/cordova-sqlite-evplus-ext-free/issues/21
- https://github.com/storesafe/cordova-sqlite-evcore-extbuild-free/issues/50#issuecomment-498858058
- https://www.compart.com/en/unicode/U+0131
- cordova-sqlite-storage test suite ref:
- https://github.com/storesafe/cordova-sqlite-storage/tree/6.0.0/spec
10 changes: 10 additions & 0 deletions sqlite3_eu.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ void init_map() {
}
}

// references:
// - https://github.com/mobilexag/cordova-sqlite-evplus-ext-free/issues/21
// - https://github.com/storesafe/cordova-sqlite-evcore-extbuild-free/issues/50#issuecomment-498858058
EU_MAP_ENTRY(0x00E4, 0x00C4);
EU_MAP_ENTRY(0x00E0, 0x00C0);
EU_MAP_ENTRY(0x00E1, 0x00C1);
Expand Down Expand Up @@ -74,6 +77,13 @@ void init_map() {
EU_MAP_ENTRY(0x00ED, 0x00CD);
EU_MAP_ENTRY(0x00EE, 0x00CE);
EU_MAP_ENTRY(0x00EF, 0x00CF);
// XXX TODO: NEED ONE-WAY MAPPING FOR U+0131 -> U+0049
// TO AVOID KNOWN ISSUE WITH SELECT LOWER_EU(9e999)
// OR SELECT LOWER_EU(-9e999)
// see cordova-sqlite-storage test suite ref:
// - https://github.com/storesafe/cordova-sqlite-storage/tree/6.0.0/spec
// see also:
// - https://www.compart.com/en/unicode/U+0131
EU_MAP_ENTRY(0x0131, 0x0049);
EU_MAP_ENTRY(0x012B, 0x012A);
EU_MAP_ENTRY(0x012F, 0x012E);
Expand Down
16 changes: 15 additions & 1 deletion test.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,25 @@ int main() {
sqlite3_exec(db, "SELECT UPPER_EU('đ ď ð abc')",
assert_result_matches, "Đ Ď Ð ABC", NULL);

// TBD STRANGE RESULT for this operation:
// ref:
// - https://www.compart.com/en/unicode/U+0131
// - https://github.com/mobilexag/cordova-sqlite-evplus-ext-free/issues/21
TESTLOG("TRY SELECT UPPER_EU('ı') - should be one-way mapping");
sqlite3_exec(db, "SELECT UPPER_EU('ı')", assert_result_matches, "I", NULL);

// XXX KNOWN ISSUE REPRODUCED AT THIS POINT:
TESTLOG("TRY SELECT LOWER_EU('I') - KNOWN ISSUE AT THIS POINT");
sqlite3_exec(db, "SELECT LOWER_EU('I')", assert_result_matches, "\u0131", NULL);

// XXX KNOWN ISSUE REPRODUCED AT THIS POINT:
// TBD STRANGE RESULT for this operation,
// see cordova-sqlite-storage test suite ref:
// - https://github.com/storesafe/cordova-sqlite-storage/tree/6.0.0/spec
TESTLOG("SELECT LOWER_EU(9e999)");
sqlite3_exec(db, "SELECT LOWER_EU(9e999)",
assert_result_matches, "ınf", NULL);

// XXX KNOWN ISSUE REPRODUCED AT THIS POINT:
// TBD STRANGE RESULT for this operation:
TESTLOG("SELECT HEX(LOWER_EU(9e999))");
sqlite3_exec(db, "SELECT HEX(LOWER_EU(9e999))",
Expand Down

0 comments on commit cc5c710

Please sign in to comment.