问题
I would like to add a unicode to the text of a SubmitField.
For instance, the code
submit = SubmitField('✉ Send')
does not work. How can I change that to show this envelope unicode?
回答1:
Just use the unicode codepoint in a \uhhhh
escape sequence, there is no need to use HTML escapes:
submit = SubmitField('\u2709 Send')
or even the codepoint itself:
submit = SubmitField('✉ Send')
The string value produced is exactly the same.
The label is quoted to ensure proper handling in HTML, so any &
characters in the label value are encoded to &
, breaking your ✉
reference.
来源:https://stackoverflow.com/questions/55879634/how-to-add-a-unicode-symbol-to-a-submit-button