简体   繁体   English

撇号显示错误2.2.4

[英]Apostrophe showing wrong on rails 2.2.4

I am trying to render an apostrophe as ' ' ', but instead on the interface, it was being rendered as "&#39"; 我试图将撇号呈现为“”,但在界面上却将其呈现为“&#39”; My code to render apostrophe looks like this: 我的呈现撇号的代码如下所示:

 <% @scheduled_events.each do |event| %>
     title  : '<%= event.title %>',    
 <% end %>

event.title on the terminal level, it's something like "Brian's". 在终端层上的event.title,类似于“ Brian's”。 Intead, it was rendered as Brian"&#39"s; Intead,它被渲染为Brian“&#39”;

I believe this is not rails case, it's HTML about rendering apostrophe, you can change the way it show with css code, or one quick (Temporary solution) is rendered within tag 我相信这不是Rails的情况,它是有关渲染撇号的HTML,您可以使用CSS代码更改其显示方式,或者在标记中渲染一种快速(临时解决方案)

<% @scheduled_events.each do |event| %>
     title  : <q>'<%= event.title %>'</q>,    
 <% end %>

以下将起作用:由于'=='不会转义字符串

title  : '<%== event.title %>', 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM