Questions tagged [html-escape]
50 questions
28
votes
3 answers
How can I make a QString html-escaped
How do I escape/sanitize a QString that contains HTML?
I.e. showInBroswser(escaped(str)) == showInNotepad(str);

sashoalm
- 75,001
- 122
- 434
- 781
20
votes
3 answers
prints HTML as-is instead of actual HTML
I am using JSF 1.2
I am trying to print text using
Now this variable contains text with html…

Ketan Bhavsar
- 5,338
- 9
- 38
- 69
14
votes
1 answer
What's the difference between Android's Html.escapeHtml and TextUtils.htmlEncode ? When should I use one or the other?
Android has two different ways to escape / encode HTML characters / entities in Strings:
Html.escapeHtml(String), added in API 16 (Android 4.1). The docs say:
Returns an HTML escaped representation of the given plain…

Jonas Czech
- 12,018
- 6
- 44
- 65
12
votes
2 answers
why does _.escape modify / characters in Underscore.js?
I was looking through the Underscore.js api and I noticed that _.escape escapes &, <, >, ", ', and / characters. What surprised me was escaping /.
Is there a reason to escape / characters that I don't know about?

zzzzBov
- 174,988
- 54
- 320
- 367
10
votes
3 answers
Using helper methods like html_escape in rails console
I am trying to see what is going wrong with my encoding of variables in my view. So I fire up rails console and try to do
$ rails console
Loading development environment (Rails 3.2.11)
irb(main):001:0> html_escape({:a=>1, :b=>"my…

highBandWidth
- 16,751
- 20
- 84
- 131
9
votes
2 answers
Why in Rails 3, <%= note.html_safe %> and <%= h note.html_safe %> give the same result?
It feels like html_safe adds an abstraction to the String class that requires understanding of what is going on, for example,
<%= '1 2' %> # gives 1 <b>2</b> in the HTML source code
<%= h '1 2' %> # exactly the…

nonopolarity
- 146,324
- 131
- 460
- 740
5
votes
2 answers
with images
I'm using JSF with Primefaces, I want to use a buttonset of radiobutton with only images but I can't make it work.
Here's the code:

Nefreo
- 2,162
- 1
- 15
- 24
4
votes
4 answers
Rails: array.join with html in separator is escaped
I have an array of Strings containing unsave content (user input).
I want to join these Strings in my template, separated by
. I tried: somearray.join("
") But this will also escape the sparator. Is there a workaround, keeping in mind…
. I tried: somearray.join("
") But this will also escape the sparator. Is there a workaround, keeping in mind…

Majiy
- 1,890
- 2
- 24
- 32
4
votes
5 answers
quotation havoc while posting data in html attribute
I want to post some data as an html attribute. Suppose there is a rails variable
@fields = [{:name => "id", :type => :integer}]
I want to post in the page for use with jquery's .data(). So in the .html.erb I have
<%= form_tag( {:action =>…

highBandWidth
- 16,751
- 20
- 84
- 131
4
votes
1 answer
Node.js - When to do HTML escape to JSON data, server or client side?
I'm using Node.js and Underscore.js. I can't determine whether to escape JSON data on server side or client side. For underscore doesn't auto escape interpolated values with syntax <%= someValue %> but with <%- someValue %>, which is in the contrast…

Trantor Liu
- 8,770
- 8
- 44
- 64
3
votes
1 answer
How to display HTML markup content from database record to browser properly in Struts 2?
I have a simple text stored in the database record: Hello wrapped in an h1 tag.
When I print this record in the JSP with the tag, it displays:
Hello
While I want it to be displayed like: Hello How can I get the…
Đào Duy Tùng
- 103
- 10
3
votes
3 answers
How to preserve the HTML when creating a .docx with docx4j?
I've started today using docx4j;
I've succesfully created a document with a table, fed with content coming from an external source.
This content has simple HTML inside, for example a column may contain a String like:
String content =…

Andrea Ligios
- 49,480
- 26
- 114
- 243
2
votes
3 answers
Undo html escape with ruby on rails data migration
I have a database, and currently many of the items within it have been html escaped. I need to undo this (don't ask why!), for which I'll carry out a data migration.
But is the a way to un-escape these strings? I've not been able to find…

tiswas
- 2,041
- 7
- 31
- 43
2
votes
0 answers
Magento Checkout Page escaping HTML tags
I've given some HTML in the custom options of Magento, it is working perfectly fine on the product page however in the checkout page, it is showing with HTML code. When I checked the source code, the HTML tags has been converted to entities. For…

Shoeb Mirza
- 912
- 1
- 11
- 30
1
vote
2 answers
How to make html code in erb tag not escaped
I have some simple erb code in one of my views in a rails project.
<%= comment.body %>
I'd like the html tags in the comment.body to be preserved as they have formatting information. I've verified that the text is saved in the database properly…

timeon
- 2,194
- 4
- 18
- 19