From b557deac7928cdd0312bc80ba0c4c7db256120d5 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 7 Jul 2023 10:15:40 +0100 Subject: [PATCH] Update comment --- plugins/tiddlywiki/sqlite3store/sql-functions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/tiddlywiki/sqlite3store/sql-functions.js b/plugins/tiddlywiki/sqlite3store/sql-functions.js index 0d3b38292..f4f7db629 100644 --- a/plugins/tiddlywiki/sqlite3store/sql-functions.js +++ b/plugins/tiddlywiki/sqlite3store/sql-functions.js @@ -18,6 +18,8 @@ $tw.SqlFunctions = function(options) { // Create field with `title TEXT NOT NULL COLLATE custom_collation` // Use it like `... order by shadow collate custom_collation` function customCollation(ptr,lenA,a,lenB,b) { + // There may be a problem here: lenA and lenB are the lengths of the two UTF8 strings in bytes, + // and yet we're using them with JS slice() method which counts in characters var jsA = $tw.sqlite3.wasm.cstrToJs(a).slice(0,lenA), jsB = $tw.sqlite3.wasm.cstrToJs(b).slice(0,lenB); return jsA.localeCompare(jsB);