From 7973ef3723053846b48018fdc7c496c0147ab09f Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Sun, 5 Sep 2021 12:02:29 +0200
Subject: [PATCH] JSON: Print invalid utf8 string to debug things

---
 CHANGELOG.md    | 1 +
 src/base/json.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index edc67bb4..518abd73 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
 - Add: versions to database
 - Add: row_format option for lkt, for small screens (can be oneline, pretty or auto)
 - Fix: endiannes functions (again)
+- Fix: fix the \_\_insert command
 - Fix: linking on some platforms where the sqlite3_hard_heap_limit64 function is not present
 - Fix: Malloc the correct struct and store it into the right pointer type...
 - Change: now have macros to wrap malloc calls
diff --git a/src/base/json.c b/src/base/json.c
index fd3392c5..783dfe3f 100644
--- a/src/base/json.c
+++ b/src/base/json.c
@@ -164,7 +164,7 @@ __decode_json(char *string, size_t len)
         /* UTF-8 decode, 4 hex digits */
         case 'u':
             if (len < 4) {
-                LOG_ERROR("JSON", "Invalid unicode string, abort decoding");
+                LOG_ERROR("JSON", "Invalid unicode string, abort decoding. String was: %s", string);
                 return;
             }
             size = 6; /* \u + 4 hex digits */
@@ -174,7 +174,7 @@ __decode_json(char *string, size_t len)
 
         /* Oups */
         default:
-            LOG_ERROR("JSON", "Invalid json string, abort the decoding");
+            LOG_ERROR("JSON", "Invalid json string, abort the decoding. String was: %s", string);
             return;
         }
 
-- 
GitLab