Skip to content

Commit

Permalink
Resolve issue with multi-byte UTF-8 characters
Browse files Browse the repository at this point in the history
(unwanted sign extension in conversion)

THANKS to @spacepope (Hannes Petersen <[email protected]>)
for pointing this one out.

Closes #2

Fixes #1
(marked as duplicate)

(Also reported in storesafe/cordova-sqlite-evcore-extbuild-free#19)
  • Loading branch information
Christopher J. Brody committed Apr 5, 2018
1 parent 1eb3ee1 commit 9bdb757
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion native/sqlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,13 @@ const char *sqlc_evcore_qc_execute(sqlc_handle_t qc, const char * batch_json, in
rrlen += 1;

while (pi < pplen) {
int pc = pptext[pi];
// Use uint8_t (unsigned char) to avoid unwanted conversion
// with sign extension:
// sqlite3_column_text() returns pointer to unsigned char
// (same thing as pointer to uint8_t)
// THANKS to @spacepope (Hannes Petersen) for
// pointing this one out.
const uint8_t pc = pptext[pi];

if (pc == '\\') {
rr[rrlen++] = '\\';
Expand Down

0 comments on commit 9bdb757

Please sign in to comment.