Commit a80a19b
committed
fix: write and read figure JSON as UTF-8
write_json wrote figure JSON with Path.write_text(json_str) and read_json
read it back with Path.read_text(), both omitting the encoding. On platforms
whose default text encoding is not UTF-8 (e.g. cp1252 on Windows), writing a
figure containing non-ASCII text raised UnicodeEncodeError and reading produced
mojibake. write_html already passes "utf-8" explicitly; apply the same to the
JSON I/O path so figures round-trip everywhere.
Update the existing pathlib mock tests to assert the UTF-8 encoding.1 parent 5cdb606 commit a80a19bCopy full SHA for a80a19b
3 files changed
+12-3Lines changed: 12 additions & 3 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- plotly/io
- tests/test_io
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+1Lines changed: 1 addition & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6 | 6 | |
7 | 7 | |
8 | 8 | |
| 9 | + |
9 | 10 | |
10 | 11 | |
11 | 12 | |
|
Collapse file
+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
295 | 295 | |
296 | 296 | |
297 | 297 | |
298 | | - |
| 298 | + |
299 | 299 | |
300 | 300 | |
301 | 301 | |
| ||
464 | 464 | |
465 | 465 | |
466 | 466 | |
467 | | - |
| 467 | + |
468 | 468 | |
469 | 469 | |
470 | 470 | |
|
Collapse file
tests/test_io/test_to_from_json.py
Copy file name to clipboardExpand all lines: tests/test_io/test_to_from_json.py+9-1Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
179 | 179 | |
180 | 180 | |
181 | 181 | |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
182 | 187 | |
183 | 188 | |
184 | 189 | |
| ||
240 | 245 | |
241 | 246 | |
242 | 247 | |
243 | | - |
| 248 | + |
| 249 | + |
| 250 | + |
| 251 | + |
244 | 252 | |
245 | 253 | |
246 | 254 | |
|
0 commit comments