I have this in my .erb file <%= text_area_tag ''text'', h(@text), :style => "width: 100%", :rows => 6 %> or <%= text_area_tag ''text'', html_escape(@text), :style => "width: 100%", :rows => 6 %> and it does not actually escape the characters This is what is in my page source <textarea id="text" name="text" rows="6" style="width: 100%">&lt;a href=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt; this is what i say</textarea> Any ideas would be appreciated Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 September 2010 04:44, Maz Zalk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have this in my .erb file > > <%= text_area_tag ''text'', h(@text), :style => "width: 100%", :rows => 6 > %> > or > <%= text_area_tag ''text'', html_escape(@text), :style => "width: 100%", > :rows => 6 %> > > and it does not actually escape the characters > > This is what is in my page source > > <textarea id="text" name="text" rows="6" style="width: 100%">&lt;a > href=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt; > this is what i say</textarea>What is in @text and what did you expect the html to look like? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote:> On 23 September 2010 04:44, Maz Zalk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> This is what is in my page source >> >> �<textarea id="text" name="text" rows="6" style="width: 100%">&lt;a >> href=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt; >> this is what i say</textarea> > > What is in @text and what did you expect the html to look like? > > ColinHi My question was not clear, I am seeing text in the textarea instead of html @text is &lt;ahref=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt;this is what i say and what I want to see is <a href="http://www.blahblah.org/blah"> LetterAttack this is what i say Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 September 2010 09:20, Maz Zalk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote: >> On 23 September 2010 04:44, Maz Zalk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> This is what is in my page source >>> >>> �<textarea id="text" name="text" rows="6" style="width: 100%">&lt;a >>> href=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt; >>> this is what i say</textarea> >> >> What is in @text and what did you expect the html to look like? >> >> Colin > > > > Hi > > My question was not clear, I am seeing text in the textarea instead of > html > > @text is > &lt;ahref=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt;this > is what i say > > and what I want to see is > <a href="http://www.blahblah.org/blah"> LetterAttack this is what i saySo, for example, you have the string "&lt;" and you want want to convert it to "<"? I think that could be tricky, it is certainly not what is meant by escaping, it is more de-escaping. Can you not start with the text in a simpler form before it is escaped? If you have only a limited set of substrings that need converting then I think you may just have to write code to convert them. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Don''t do anything and the escaped characters will appear as you intend. in view code: <% text = " <a href= "http://www.blahblah.org/ blah">LetterAttack...</a > is what i say" -%> <textarea><%= text -%></textarea> renders like this: <a href= "http://www.blahblah.org/blah">LetterAttack...</a > is what i say On Sep 23, 4:32 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 September 2010 09:20, Maz Zalk <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > > > > > > Colin Law wrote: > >> On 23 September 2010 04:44, Maz Zalk <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >>> This is what is in my page source > > >>> <textarea id="text" name="text" rows="6" style="width: 100%">&lt;a > >>> href=&quot;http://www.blahblah.org/blah">LetterAttack</a&... > >>> this is what i say</textarea> > > >> What is in @text and what did you expect the html to look like? > > >> Colin > > > Hi > > > My question was not clear, I am seeing text in the textarea instead of > > html > > > @text is > > &lt;ahref=&quot;http://www.blahblah.org/blah">LetterAttack</a&... > > is what i say > > > and what I want to see is > > <a href="http://www.blahblah.org/blah"> LetterAttack this is what i say > > So, for example, you have the string "&lt;" and you want want to > convert it to "<"? > I think that could be tricky, it is certainly not what is meant by > escaping, it is more de-escaping. Can you not start with the text in > a simpler form before it is escaped? If you have only a limited set > of substrings that need converting > then I think you may just have to write code to convert them. > > Colin-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
html_scape does that , you are causing the output -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 September 2010 15:03, Phillip <omsdialogue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Don''t do anything and the escaped characters will appear as you > intend. > > in view code: > <% text = " <a href= "http://www.blahblah.org/ > blah">LetterAttack...</a > > is what i say" -%> > > <textarea><%= text -%></textarea> > > renders like this: > <a href= "http://www.blahblah.org/blah">LetterAttack...</a > > is what i sayWill it not display <a href... on screen rather than generating an html href tag? Colin> > > On Sep 23, 4:32 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 23 September 2010 09:20, Maz Zalk <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >> >> >> >> >> > Colin Law wrote: >> >> On 23 September 2010 04:44, Maz Zalk <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >>> This is what is in my page source >> >> >>> <textarea id="text" name="text" rows="6" style="width: 100%">&lt;a >> >>> href=&quot;http://www.blahblah.org/blah">LetterAttack</a&... >> >>> this is what i say</textarea> >> >> >> What is in @text and what did you expect the html to look like? >> >> >> Colin >> >> > Hi >> >> > My question was not clear, I am seeing text in the textarea instead of >> > html >> >> > @text is >> > &lt;ahref=&quot;http://www.blahblah.org/blah">LetterAttack</a&... >> > is what i say >> >> > and what I want to see is >> > <a href="http://www.blahblah.org/blah"> LetterAttack this is what i say >> >> So, for example, you have the string "&lt;" and you want want to >> convert it to "<"? >> I think that could be tricky, it is certainly not what is meant by >> escaping, it is more de-escaping. Can you not start with the text in >> a simpler form before it is escaped? If you have only a limited set >> of substrings that need converting >> then I think you may just have to write code to convert them. >> >> Colin > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Phillip wrote:> Don''t do anything and the escaped characters will appear as you > intend. > > in view code: > <% text = " <a href= "http://www.blahblah.org/ > blah">LetterAttack...</a > > is what i say" -%> > > <textarea><%= text -%></textarea> > > renders like this: > � <a href=� "http://www.blahblah.org/blah">LetterAttack...</a > > is what i sayIn the textarea on the html page it is rendering like &lt;ahref=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt;this is what i say it is not <a href="http://www.blahblah.org/blah"> LetterAttack this is what i say in the textarea @text; h(@text); html_escape(@text) in the .erb file all display &lt;ahref=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt;this is what i say in the textarea on the html page (where @text is &lt;ahref=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt;this is what i say) I want it to display <a href= "http://www.blahblah.orgblah">LetterAttack...</a> is what i say Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 24 September 2010 05:58, Maz Zalk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Phillip wrote: >> Don''t do anything and the escaped characters will appear as you >> intend. >> >> in view code: >> <% text = " <a href= "http://www.blahblah.org/ >> blah">LetterAttack...</a > >> is what i say" -%> >> >> <textarea><%= text -%></textarea> >> >> renders like this: >> � <a href=� "http://www.blahblah.org/blah">LetterAttack...</a > >> is what i say > > > In the textarea on the html page it is rendering like > &lt;ahref=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt;this > is what i say > > it is not > <a href="http://www.blahblah.org/blah"> LetterAttack this is what i say > in the textarea > > @text; h(@text); html_escape(@text) in the .erb file all display > &lt;ahref=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt;this > is what i say > in the textarea on the html page > (where @text is > &lt;ahref=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt;this > is what i say) > > I want it to display <a href> "http://www.blahblah.orgblah">LetterAttack...</a> is what i sayI am still confused I am afraid. Do you want it to _display_ <a href =... so that is exactly what appears on the screen, or do you want it to display a link to the URL, showing the text LetterAttack? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote:> On 24 September 2010 05:58, Maz Zalk <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> >> <a href="http://www.blahblah.org/blah"> LetterAttack this is what i say >> I want it to display <a href>> "http://www.blahblah.orgblah">LetterAttack...</a> is what i say > > I am still confused I am afraid. Do you want it to _display_ <a href > =... so that is exactly what appears on the screen, or do you want it > to display a link to the URL, showing the text LetterAttack? > > ColinHi I want to display html in the textarea i.e more like de-scaping as you describe <%= label_tag ''text'', @text %><br/> <%= text_area_tag ''text'', @text , :style => "width: 100%", :rows => 6 %> The label displays correctly i.e. <a href="http://www.blahblah.orgblah">LetterAttack...</a> is what i say whereas in the textarea it is displayed as &lt;ahref=&quot;http://www.blahblah.org/blah&quot;&gt;LetterAttack&lt;/a&gt;this is what i say Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
add .html_safe -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.