Skip to content
Snippets Groups Projects
Commit 9dc10d0f authored by Duc Bui Tien's avatar Duc Bui Tien
Browse files

bugfix utf-8 special char writing

parent fde2cd65
No related branches found
No related tags found
2 merge requests!2UnicadoGuiBackend,!1New UnicadoGUI Branch
......@@ -116,24 +116,24 @@ async def get_module_config(module: str):
tree = ET.parse("xml_configs/"+module+"_conf.xml")
root = tree.getroot()
#config = json.dumps(xmltodict.XmlDictConfig(root))
with open("xml_configs/"+module+"_conf.xml", encoding='utf8') as fd:
with open("xml_configs/"+module+"_conf.xml", encoding='utf-8') as fd:
config = json.dumps(xmltodict.parse(fd.read()))
return config
@app.put("/modules/config/update")
async def update_module_config(config: Conf):
dict = {"module_configuration_file": config.module_configuration_file}
xml = xmltodict.unparse(dict, pretty=True)
print(xml)
with open("xml_configs/" + config.module_configuration_file["@name"], "w") as fd:
with open("xml_configs/" + config.module_configuration_file["@name"], "w", encoding='utf-8') as fd:
fd.write(xml)
return
@app.get("/modules/{module}/config/reset")
async def reset_module_config(module:str):
with open("xml_configs/"+module+"_conf_default.xml", encoding='utf8') as fd:
config = json.dumps(xmltodict.parse(fd.read()))
with open("xml_configs/"+module+"_conf.xml", "w") as fd:
fd.write(config)
with open("xml_configs/"+module+"_conf_default.xml", encoding='utf-8') as fd:
dict = xmltodict.parse(fd.read())
xml = xmltodict.unparse(dict, pretty=True)
with open("xml_configs/"+module+"_conf.xml", "w", encoding='utf-8') as fd:
fd.write(xml)
return
@app.get("/graph/")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment