search

Home  >  Q&A  >  body text

python - flash和bootstrap/wtf.html怎么才能支持中文呢?

迷茫迷茫2866 days ago703

reply all(5)I'll reply

  • PHPz

    PHPz2017-04-17 17:04:42

    Use Unicode internally, such as:

    submit = SubmitField(u'登陆')

    The template file must be saved in UTF-8 format encoding.

    reply
    0
  • 迷茫

    迷茫2017-04-17 17:04:42

    Add u in front of the string and pass in a unicode

    reply
    0
  • 黄舟

    黄舟2017-04-17 17:04:42

    Add this code before the python file

    import sys
    default_encoding = 'utf-8'
    if sys.getdefaultencoding() != default_encoding:
        reload(sys)
        sys.setdefaultencoding(default_encoding)

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 17:04:42

    That’s why I switched to python3

    reply
    0
  • PHPz

    PHPz2017-04-17 17:04:42

    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')) 

    reply
    0
  • Cancelreply