Skip to content

Commit

Permalink
Merge pull request #165 from chinyihan/encoding_utf8
Browse files Browse the repository at this point in the history
Added encoding utf8
  • Loading branch information
nicolaisi authored Jun 27, 2024
2 parents 074ba43 + da947f1 commit 6c52ee5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def get(self):
print("In designer mode.")

# check other data sources: rtsp or rest
with open("style.yaml", 'r') as stream:
with open("style.yaml", 'r', encoding='utf8') as stream:
try:
style_data = yaml.load(stream, Loader=yaml.Loader)
except yaml.YAMLError as exc:
Expand Down Expand Up @@ -346,7 +346,7 @@ class SaveHandler(tornado.web.RequestHandler):
def post(self):
json_obj = json_decode(self.request.body)

with open("style.yaml", 'wb') as output:
with open("style.yaml", 'wb', encoding='utf8') as output:
output.write(yaml.safe_dump(json_obj, encoding='utf-8',
allow_unicode=True, default_flow_style=False))
response = {"success": "Data entry inserted."}
Expand All @@ -366,7 +366,7 @@ def options(self, *args):

def get(self):
#print( "In status mode.")
with open("style.yaml", 'r') as stream:
with open("style.yaml", 'r', encoding='utf8') as stream:
try:
style_data = yaml.load(stream, Loader=yaml.Loader)
except yaml.YAMLError as exc:
Expand All @@ -386,7 +386,7 @@ def get(self):

class GetDataHandler(tornado.web.RequestHandler):
def get(self):
with open("style.yaml", 'r') as stream:
with open("style.yaml", 'r', encoding='utf8') as stream:
try:
style_data = yaml.load(stream, Loader=yaml.Loader)
except yaml.YAMLError as exc:
Expand Down

0 comments on commit 6c52ee5

Please sign in to comment.