HuimingCheng/AutoGrading

How to add static file in html when there is non ascii char in file path

Closed this issue · 1 comments

In my static image path, there are some Chinese char in path. So I can not add them into html file. I use flask, it use jinja to load static file. I can easily move the whole file folder into a folder which does not contain Chinese char in path. But I want to find some else better way to fix this bug

Let system use UTF8 to encode the path string. Then the bug can be fixed.
In backend python file, add these code:

import sys
reload(sys)
sys.setdefaultencoding("UTF8")