Cameron Bass Cameron Bass - 2 months ago 7x
HTML Question

Special character encoding not working? (&)

I've have tried to encode the

like so
. However, when I tried this it did not fix it in my title like I'm reading it should on Stackoverflow. Just to be clear my page title still says
Plan & Billing
in the browser and In my code I have
Plan & Billing
. Why is the encoding not working? (p.s. it works with other special characters)


<% page_title 'Plan &amp; Billing • My Account' %>

This question is unique to any other I have found because I'm asking "Why my encoding is not working", where as, suggested duplicates only say "Why you need them for encoding".

Ren Ren

As mentioned in the comments, your string should be made html_safe:

<% page_title 'Plan &amp; Billing • My Account'.html_safe %>

You can also use the sanitize method:

<% page_title sanitize('Plan &amp; Billing • My Account') %>