jp (forums/edit): fixed unicode when dumping in json
This commit is contained in:
parent
5f226a669c
commit
38597f81cf
1 changed files with 4 additions and 1 deletions
|
|
@ -24,6 +24,7 @@ from sat_frontends.jp.constants import Const as C
|
|||
from sat_frontends.jp import common
|
||||
from sat.tools.common.ansi import ANSI as A
|
||||
from functools import partial
|
||||
import codecs
|
||||
import json
|
||||
|
||||
__commands__ = ["Forums"]
|
||||
|
|
@ -69,7 +70,9 @@ class Edit(base.CommandBase, common.BaseEdit):
|
|||
if forums_json:
|
||||
# we loads and dumps to have pretty printed json
|
||||
forums = json.loads(forums_json)
|
||||
json.dump(forums, content_file_obj, ensure_ascii=False, indent=4)
|
||||
# cf. https://stackoverflow.com/a/18337754
|
||||
f = codecs.getwriter('utf-8')(content_file_obj)
|
||||
json.dump(forums, f, ensure_ascii=False, indent=4)
|
||||
content_file_obj.seek(0)
|
||||
self.runEditor("forums_editor_args", content_file_path, content_file_obj)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue