On Mon, Mar 25, 2013 at 2:58 PM, Y S <yusuh...@gmail.com> wrote:
> How should we approach the problem is the tab character is to be included in
> the string. For example,
>
> <% c = '\t' %>
> <input type='hidden' name='char' value='<%=html_escape(c) %>' >
> just shows the tab as a space.

The tab char (\t) is not converted by html_escapes() as far as I know;
if you want to make it an HTML-ish entity, you're probably going to
have to encode that yourself (it's &#0011; , btw). Even so, I'm not
sure what the value of that would be, as it doesn't actually seem to
fill up any space in an input text box.

> Also, shouldn't Rails helper tags use single quotes since they work in both
> cases:
> <% c1 = "'" %>
> <input type='hidden', name='char1' value='<%= html_escape(c1) %>'>
>
> <% c2 = '"' %>
> <input type='hidden', name='char2' value='<%= html_escape(c2) %>'>

In both cases, the characters c1 and c2 are being converted to HTML
entities, &apos; and &quot; respectively, and no longer contain and
sort of "quoteness" (if you'll permit) in the HTML context they get
rendered in.

I'm not about to say anything regarding which quoting should be
policy; in fact I'll argue strenuously against any such policy.


> Thanks! I really appreciate the discussion.

My pleasure!

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to