python - flash和bootstrap/wtf.html怎么才能支持中文呢?
迷茫
迷茫 2017-04-17 17:02:42
0
5
682
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(5)
PHPzhong

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

PHPzhong

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')) 
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template