HTML Named character references #168
-
I need to output ✉ in a template, which is an envelope character. See: https://www.toptal.com/designers/htmlarrows/symbols/envelope/ Just using "✉" in a template doesn't work since that gets escaped. Love this new gem! Thanks for all the hard work. Allan |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hey, thanks for the kind words and for reporting this issue. I think Phlex should allow emoji in text but I’m not entirely sure why it’s being escaped. While I look into this, you should be able to use Only use |
Beta Was this translation helpful? Give feedback.
-
Hey @allan-farrell, I can't seem to reproduce the issue you mentioned. This is the test I’m using: with "text" do
with "emoji" do
component do
def template
text "✉️"
end
end
it "doesn't break the emoji" do
expect(output).to be == "✉️"
end
end
end Is it possible you need to add a charset meta tag to the head of your HTML document? meta charset: "utf-8" |
Beta Was this translation helpful? Give feedback.
Hey, thanks for the kind words and for reporting this issue. I think Phlex should allow emoji in text but I’m not entirely sure why it’s being escaped. While I look into this, you should be able to use
raw "✉️"
to get unblocked.Only use
raw
with a safe string literal, don’t pass any user-generated content into it.