How to add a unicode symbol to a submit button

淺唱寂寞╮ 提交于 2019-12-25 02:47:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!