Skip to content

Emojis are not valid if they have a variant selector character attached #5564

@lukasmasuch

Description

@lukasmasuch

Summary

Emojis are not valid if they are prefixed with a variant selector character. This is a hidden character that is used as prefix for the emoji (more information here).

Steps to reproduce

Open in Streamlit Cloud

Code snippet:

st.error("This is an error", icon="🚨") # Works fine
st.error("This is an error", icon="️🚨") # Throws an error

The reason is that the second example is prefix with this hidden unicode character: %uFE0F:

st.write(len("🚨"))  # 1
st.write(len("️🚨"))  # 2

Expected behavior:

Should not raise an exception.

Actual behavior:

Raises a StreamlitAPIException if used for st.error, st.info, ...

Is this a regression?

no

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.infoRelated to the `st.info` elementgood first issueGood for newcomers to the codebasepriority:P2Medium-high priority - fix within one monthstatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions