业精于勤,荒于嬉;行成于思,毁于随。
Use Unicode internally, such as:
submit = SubmitField(u'登陆')
The template file must be saved in UTF-8 format encoding.
Add u in front of the string and pass in a unicode
Add this code before the python file
import sys default_encoding = 'utf-8' if sys.getdefaultencoding() != default_encoding: reload(sys) sys.setdefaultencoding(default_encoding)
That’s why I switched to python3
Suddenly I realized that what I wrote was a stupid method,
email=StringField('电子邮箱‘.decode('utf-8'),validators=[Required(),Length(1,64),Email()]) password=PasswordField('密码'.decode('utf-8'),validators=[Required()]) remember_me=BooleanField('记住我?'.decode('utf-8'))
Use Unicode internally, such as:
The template file must be saved in UTF-8 format encoding.
Add u in front of the string and pass in a unicode
Add this code before the python file
That’s why I switched to python3
Suddenly I realized that what I wrote was a stupid method,