Open NamelessAshone opened 3 years ago
def render_json(dictionary=None):
dictionary = {} if dictionary is None else dictionary
response = HttpResponse(json.dumps(dictionary), content_type="application/json")
response['Access-Control-Allow-Origin'] = '*'
response["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type"
response["Access-Control-Allow-Methods"] = "GET, POST, PUT, OPTIONS"
return response
或许是这部分json.dumps
需要修改为json.dumps(dictionary, encoding='utf8', ensure_ascii=False)
?
您好!
使用metis的docker镜像测试时,发现响应中的中文显示不正常
日志:
hexdump
保存下来的响应json文件, 中文操作成功
被编码为了"\u45fc\u4f5c\u6210\u529"
字符串