From a888304b19cf1ed144341a8218a9421f47248d4e Mon Sep 17 00:00:00 2001 From: Ryan Clark Date: Mon, 16 Nov 2026 16:54:24 -0700 Subject: [PATCH] Don't truncate multi-byte characters in json output (#428) don't truncate multi-byte characters in json output --- geojson-loop.cpp | 3 ++- read_json.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/geojson-loop.cpp b/geojson-loop.cpp index e4f2f40b..5d620940 100644 --- a/geojson-loop.cpp +++ b/geojson-loop.cpp @@ -12,6 +12,7 @@ #include #include "geojson-loop.hpp" #include "jsonpull/jsonpull.h" +#include "text.hpp" // XXX duplicated #define GEOM_TYPES 6 @@ -29,7 +30,7 @@ static void json_context(json_object *j) { std::string s = json_stringify(j); if (s.size() >= 500) { - s.resize(497); + s = truncate_string(s, 497); s.append("..."); } diff --git a/read_json.cpp b/read_json.cpp index ec0b1cfd..725d7226 100644 --- a/read_json.cpp +++ b/read_json.cpp @@ -46,7 +46,7 @@ void json_context(json_object *j) { std::string s = json_stringify(j); if (s.size() >= 500) { - s.resize(497); + s = truncate_string(s, 497); s.append("..."); }