Skip to content

Commit ce111d2

Browse files
committed
Dump Unicode characters to a file
1 parent 7d8d22b commit ce111d2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ print(JDKSObject.getObject())
397397
---
398398

399399
## CHANGELOG
400+
#### [json-duplicate-keys v2025.y.x](https://github.com/truocphan/json-duplicate-keys/tree/2025.y.x)
401+
- [**Updated**] Add an exception when loading a non-existent file
402+
- [**Updated**] Dump Unicode characters to a file
403+
400404
#### [json-duplicate-keys v2025.7.1](https://github.com/truocphan/json-duplicate-keys/tree/2025.7.1)
401405
- [**Updated**] Fixed some issues when loading JSON strings with `skipDuplicated` option
402406
- [**Updated**] Allow loading of JSON data in byte string format

json_duplicate_keys/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ def dump(self, Jfilepath, dupSign_start="{{{", dupSign_end="}}}", _isDebug_=Fals
561561
Jstr = self.dumps(dupSign_start=dupSign_start, dupSign_end=dupSign_end, _isDebug_=_isDebug_, skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, cls=cls, indent=indent, separators=separators, default=default, sort_keys=sort_keys)
562562

563563
try:
564-
Jfile = open(Jfilepath, "w")
565-
Jfile.write(Jstr)
564+
Jfile = open(Jfilepath, "wb")
565+
Jfile.write(Jstr.encode("utf-8"))
566566
Jfile.close()
567567
except Exception as e:
568568
if _isDebug_: print("\x1b[31m[-] ExceptionError: {}\x1b[0m".format(e))

0 commit comments

Comments
 (0)