Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json.dump(ensure_ascii=False) #14108

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def thread_func():
with cache_lock:
cache_filename_tmp = cache_filename + "-"
with open(cache_filename_tmp, "w", encoding="utf8") as file:
json.dump(cache_data, file, indent=4)
json.dump(cache_data, file, indent=4, ensure_ascii=False)

os.replace(cache_filename_tmp, cache_filename)

Expand Down
2 changes: 1 addition & 1 deletion modules/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def save(self, filename):
assert not cmd_opts.freeze_settings, "saving settings is disabled"

with open(filename, "w", encoding="utf8") as file:
json.dump(self.data, file, indent=4)
json.dump(self.data, file, indent=4, ensure_ascii=False)

def same_type(self, x, y):
if x is None or y is None:
Expand Down
2 changes: 1 addition & 1 deletion modules/ui_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def save_config_state(name):
filename = os.path.join(config_states_dir, f"{timestamp}_{name}.json")
print(f"Saving backup of webui/extension state to {filename}.")
with open(filename, "w", encoding="utf-8") as f:
json.dump(current_config_state, f, indent=4)
json.dump(current_config_state, f, indent=4, ensure_ascii=False)
config_states.list_config_states()
new_value = next(iter(config_states.all_config_states.keys()), "Current")
new_choices = ["Current"] + list(config_states.all_config_states.keys())
Expand Down
2 changes: 1 addition & 1 deletion modules/ui_extra_networks_user_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def write_user_metadata(self, name, metadata):
basename, ext = os.path.splitext(filename)

with open(basename + '.json', "w", encoding="utf8") as file:
json.dump(metadata, file, indent=4)
json.dump(metadata, file, indent=4, ensure_ascii=False)

def save_user_metadata(self, name, desc, notes):
user_metadata = self.get_user_metadata(name)
Expand Down
2 changes: 1 addition & 1 deletion modules/ui_loadsave.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def read_from_file(self):

def write_to_file(self, current_ui_settings):
with open(self.filename, "w", encoding="utf8") as file:
json.dump(current_ui_settings, file, indent=4)
json.dump(current_ui_settings, file, indent=4, ensure_ascii=False)

def dump_defaults(self):
"""saves default values to a file unless tjhe file is present and there was an error loading default values at start"""
Expand Down