I have a blog project using Kemal where some of my post titles and post page content could have emoji characters.
I can see the emoji if I render static html which has them, and I can see the emoji in the Postgres data. I even have a Spec which tests the Postgres post title value with the expected emoji string. It passes.
However, if I have a ECR template which tries to render the variable which has emoji, the emoji isn’t rendered.
<ul>
<%- posts.each do |post| -%>
<li><a href="<%= post.url %>"><%= post.title %></a></li>
<%- end -%>
</ul>
What gets displayed is the literal unicode characters, not the emoji.
Is there something I need to do to enable this? Maybe an .encode
or .html_safe
or something similar?