Mauro
Mauro

Reputation: 237

How to add a unicode symbol to a submit button

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?

Upvotes: 0

Views: 1044

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1122372

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.

Upvotes: 1

Related Questions