`--output-format=html` incorrectly encodes some characters
**Describe the bug**
When using `--output-format=html` (e.g. in `kart show` or `kart diff` CLI), some characters will be encoded in a way that makes the resulting html page fail to load.
**To Reproduce**
Steps to reproduce the behaviour:
1. Modify a dataset so a field includes a special character such as `/`,`<`,`>`.
2. `kart show --output-format=html --output show.html`
3. A browser will open, displaying show.html, but no page content.
4. Open browser dev tools --> console.
5. See error (similar to "Uncaught SyntaxError: JSON.parse: bad escaped character at line 1 column 85159 of the JSON data")
6. Page source will include something like `{"fid": 1, "name": "a name \x3c\x2f\x3e with special chars"}`
**Expected behaviour**
What did you expect to happen?
The HTML page should work, displaying a map and table of changes the same way as when there are no special characters.
**Output**
Add the output you're seeing to help explain your problem.
**Version Info **
- OS: `Ubuntu 24.04.3 LTS (6.11.0-29-generic x86_64 GNU/Linux)`
- Version: [from `kart version`]
```
Kart v0.16.1, Copyright (c) Kart Contributors
» GDAL v3.8.5; PROJ v9.4.0; PDAL v2.7.2
» PyGit2 v1.12.1; Libgit2 v1.6.4; Git v2.47.1; Git LFS v3.3.0
» SQLAlchemy v1.4.45; pysqlite3 v2.6.0/v3.45.3; SpatiaLite v5.1.0; Libpq v16.0.2
```
关闭于 2026-03-04 1 条评论