How to use a html entity inside .ex file?

I have a function that builds attrs in .ex file and those attributes are used in html.leex file.

I am not sure how to make this work.

defp build_attrs(), do: ↑

But when I run, this fails with this error - "syntax error before: end. "end" is a reserved word in Elixir and therefore its usage is limited. For instance, it can't be used as a variable or be defined nor invoked as a regular function"

But this works

defp build_attrs(), do: " ↑"

I prefer using html entity, I mean the code. How can I achieve it?

defp build_attrs(), do: "↑"

This should work fine, you just needed to quote it to make it a string.

I did this but it returns this ↑ instead of ↑

If you’re using it in a Phoenix view you’ll probably want to also use raw/1 By default Phoenix is going to escape HTML for safety reasons.