diff --git a/src/drf_yasg/codecs.py b/src/drf_yasg/codecs.py index dad4e229..a5826edf 100644 --- a/src/drf_yasg/codecs.py +++ b/src/drf_yasg/codecs.py @@ -117,12 +117,12 @@ def _dump_dict(self, spec): :rtype: str""" if self.pretty: - out = json.dumps(spec, indent=4, separators=(',', ': ')) + out = json.dumps(spec, indent=4, separators=(',', ': '), ensure_ascii=False) if out[-1] != '\n': out += '\n' return out else: - return json.dumps(spec) + return json.dumps(spec, ensure_ascii=False) YAML_MAP_TAG = u'tag:yaml.org,2002:map' @@ -199,7 +199,13 @@ def yaml_sane_dump(data, binary): :return: the serialized YAML :rtype: str or bytes """ - return yaml.dump(data, Dumper=SaneYamlDumper, default_flow_style=False, encoding='utf-8' if binary else None) + return yaml.dump( + data, + Dumper=SaneYamlDumper, + default_flow_style=False, + encoding='utf-8' if binary else None, + allow_unicode=binary + ) class SaneYamlLoader(yaml.SafeLoader):