view raw
Lorena Bento Lorena Bento - 6 months ago 47
Ruby Question

Insert HTML special characters in (i18n) yml

I need to insert a special character in the html file translation.
The character is a space, need it to try to solve another problem.

But it is not working. The code for that character is displayed in the subject of the email.

For this I insert these lines:


release_auto_pause_triggered_html: "%{project_name} %{release_name} - pausa automática   disparada"


subject = t('subjects.release_auto_pause_triggered_html', project_name:, release_name:

But the subject of the email sent is as follows:
pausa automática disparada

  • The "'" I added just to make this post, but it would not give to see here.

I need to look like this: "pausa automática disparada"

Where am I going wrong?


I think I manage to do it. Try this "pausa automática\xA0disparada"


Using single-quoted scalars, you may express any value that does not contain special characters. No escaping occurs for single quoted scalars except that a pair of adjacent quotes '' is replaced with a lone single quote '.

Double-quoted is the most powerful style and the only style that can express any scalar value. Double-quoted scalars allow escaping. Using escaping sequences \x** and \u**, you may express any ASCII or Unicode character.

And here I found the necessary code

My output is:

title: "Title \xA0 aaa"
# console
=> "Title   aaa"