Forms "My Tr...">

Is there a way to use Chapter ASCII codes in rails link helpers?

It:

<%= link_to "My Trademark &153;", trade_mark_path %>

Forms

"My Trademark & ​​153;"

When I Really Need It: My Trademark ™

Can I use ASCII codes in a URL helper? I can always resort to creating the link manually, but it is really ugly.

+5
source share
3 answers

The simplest answer is not to use HTML entities, but instead use Unicode source code files with Unicode literal characters, for example. actually put:

<%= link_to "My Trademark™", trade_mark_path %>

in your view. However, if you need to, you can simply:

<%= link_to("My Trademark&trade;", trade_mark_path).html_safe %>

to disable automatic removal of Rails from Rails.

, &#...; ASCII 128-255 - , , , HTML-. , Unicode &#8482;.

+3

, , raw , .

- , literal escape \u, HTML-, :

<%= link_to "My Trademark\u2122", trade_mark_path %>

- U + 2122 8482. 153 - Windows 1252, , &#153; . -XML- HTML - ( HTML5), .

+4

raw :

<%= link_to raw("My Trademark &153;"), trade_mark_path %>

http://apidock.com/rails/ActionView/Helpers/OutputSafetyHelper/raw

+3

All Articles