-1
votes
1answer
47 views

HTML entities in CSS content (convert entities to escape-string at runtime)

I know that html-entities like   or ö or ð can not be used inside a css like this: div.test:before { content:"text with html-entities like ` ` or `ö` ...
0
votes
1answer
15 views

Use javascript to convert special character back to HTML entity code

In one function of my site, the inner HTML of a div element is changed to include a right arrow. This symbol is included in the innerHTML of "myDiv" as ➞ In a separate function, I am ...
3
votes
7answers
98 views

How to print a pound “£” in html file?

i am trying to display a pound sign in my html page.i want to display it through a variable because i am getting the values of sign from an xml file. Here is Code: var sign = ...
0
votes
3answers
38 views

Html entities manipulated with Javascript

I'm having issues in a formular with some htmlentities in the value attributes: <form> <input name="my-text" type="text" value="hello &amp; world"> </form> //Display in my ...
0
votes
1answer
80 views

AngularJS equivalent of .html() to replace html chars

In jQuery, if you have a string with HTML in it you can process the HTML in it and replace special characters like '&' with '&' var myString = 'Jack &amp; Jill'; var filtered = ...
0
votes
1answer
60 views

jQuery / JS and HTML entity decoding.

I've got this HTML entity I need to use as the title attribute and href attribute on a link (&#8211;) how do I escape/decode this for use? I'm using jQuery, do either a vanilla jS or jQuery method ...
0
votes
1answer
64 views

Javascript encode HTML entities on server

In my server application (on Parse Cloud Code), I want save some string data. There are HTML entities here, which I want to encode. So i find a solution with Javascript: var txt = ...
1
vote
1answer
113 views

HTML Entity to Unicode conversion [duplicate]

Is there some way to convert HTML Entities into unicode characters in Javascript? I tried var unicodeHtmlEntity = function (t) { numericValue = parseInt(t.slice(2, -1), 10); numericValue = ...
0
votes
1answer
171 views

How to sanitize an xml file with jquery, ie replace illegal chars with html entities

I have a jquery get command which gets the contents of an xml file. Unfortunately, some of the xml files i'm reading have unescaped special characters in them ('&' for example). Initially i was ...
0
votes
1answer
77 views

Comparing escaped data with select box's unescaped value in JavaScript?

I have a page where I get select box options using an AJAX request, build a select box from that data, and then later use the selected value of the select box to get additional info from the response ...
0
votes
3answers
941 views

Document.write(<script>) throws Unexpected token “ILLEGAL”

Before you ask, I already searched a lot in Stack Overflow and I google it thousand times. Any other case I ever seen here helped me. Let's go to my problem: I'm trying to use the following script ...
0
votes
1answer
257 views

ckeditor character count decoding html entities

alert(CKEDITOR.instances.editor1.getData().replace(/<[^>]*>|\s/g, '').length); I'm using this code to retrieve the character count of text written into the editor. Unfortunately if writing ...
0
votes
1answer
152 views

How to properly use htmlentities() and deal with XSS while still allowing quotes

Ok I have a form to create a new record. The form takes in several text fields. Prior to putting them into the database I run the fields through htmlentities($field, ENT_QUOTES). That's great. ...
1
vote
0answers
59 views

Display TinyMCE inputted text causing undisplayable characters

Website is set to use UTF-8 so this should not be the issue: <meta charset="utf-8"> Looking in the TinyMCE "View Source" option here is what the code looks like: <p>Posted by J. ...
0
votes
3answers
273 views

Decode HTML character references in JavaScript string

In my program, I have this string in entry: var toto = "Lo&#195;&#175;c"; I would like to decode this String in order to have: 'Loïc' How can I do that?
2
votes
2answers
99 views

Is it possible to convert a font icon back into it's private use code?

For example, I am using fontAwesome, and I have a span that contains an icon: written in html: <span class="icon">&#xf05a;</span> though once actually rendered on the page: ...
0
votes
2answers
234 views

How to remove unwanted spaces in html tags using Javascript?

i have one java script variable. variable is given below var str = '< table class = "buy_selection" > < tbody > < tr > < th > size < / th > < td > < ...
0
votes
0answers
340 views

Html entity &quot; is replaced with actual double quote while using document.body.innerHTML

In my case, server sends following html response {"Testlink":"&lt;a href=&quot;http://www.google.com&quot;&gt;Google&lt;/a&gt;"} This response is set to body. When I read ...
0
votes
3answers
109 views

Why can't I get this entity code to display correctly in a browser?

I'm trying to code a UK Pound symbol to be written to a document by JavaScript, but it's code is not being translated and is instead displayed as entered. See this JSBin ...
3
votes
3answers
2k views

How to get MVC model strings as plain text in views

I'm sending a model to a view that have strings. Those strings are html encoded and I do not need them to be. Any way to send a model to a view without html encoding? Model: public class Package { ...
1
vote
2answers
248 views

How do I find the string index of a tag (an element) without counting expanded entities?

I've got a large piece of text which I want to be able to select, storing the selected part by its startindex and endindex. (For example, selecting or in word would give me startindex 1 and endindex ...
1
vote
2answers
3k views

jQuery .append() not rendering html entity

I have a variable with html in it like this: var html = '<div>Hello, you&#39;re awesome!</div>'; I want to append it to an element $("body").append(html) for some reason it's not ...
0
votes
1answer
407 views

Knockout: Decoding html entities in an input field

I have a web app that allows users to submit and save HTML. The user types in the html s/he wants to use into several different fields. Some are text input elements and some are textarea elements. ...
4
votes
1answer
1k views

Encode HTML entities

I am parsing some data from feedburner of which contains HTML entities. I am trying to encode the HTML entities using jQuery as such: var encodedStr = data['1']['result']['content']; // content with ...
3
votes
2answers
402 views

Assign a HTML-entity as an attribute value using JavaScript/jQuery

I've been following this technique on css-tricks to add icons to a website: http://css-tricks.com/html-for-icon-font-usage/ I've got this in my CSS: [data-icon]:before { font-family: Symbol; ...
1
vote
1answer
150 views

How to make Dijit Editor keep &nbsp;?

Dijit Editor removes all &nbsp; entities from user input. With a Dijit Editor in hand, go into HTML mode, enter some text with some &nbsp; inside. Go back to WYSIWYG mode, back to HTML mode, ...
1
vote
2answers
753 views

Html entities of Euro symbol showing in AJAX response instead of actual Euro symbol - getting &euro; instead of €

I am doing an AJAX call and in the AJAX handler code (PHP side) I have to return a string containing the currency symbol. I have &euro; to begin with in the PHP side, which I try to encode using ...
4
votes
1answer
364 views

get original dom element innerHTML without javascript processing

Background - in an article editor powered by TinyMCE for an enterprise in-house CMS behind large media site/s HTML <p>non-breaking-space: &nbsp; pound: &pound; copyright: ...
0
votes
1answer
154 views

How to decode HTML entities in JavaScript using in a Ruby on Rails project

I am dealing with Ruby on Rails and JavaScript. The main basic idea is that I create an object in my model's class function and call this function in JavaScript. The problem there is that anywhere the ...
-1
votes
1answer
103 views

insertAdjacentHTML with iframe turns the content into HTML entities

I'm trying to insert a iframe at the end of an element using insertAdjacentHTML. But for some reason the content inside the iframe gets turned into HTML entities ("<" to &lt, ">" to &gt). ...
2
votes
3answers
1k views

How to tell if a string contains HTML entity (like &amp;)?

I'm trying to write a function that checks a parameter against an array of special HTML entities (like the user entered '&amp' instead of '&'), and then add a span around those entered ...
0
votes
0answers
145 views

Chrome is guessing HTML entities?

I have a simple function that mimics the "ellipses" effect on the end of text as a cross browser solution. The function removes 2 characters from the end of the text and sees if there is still an ...
1
vote
1answer
38 views

how to ignore nonused space from word like “Test - Text” while building html tags

I am forming a tag like this "<a href=instruction=name,value=" + sParameter +">"</a>" But i am expecting some text separated by space Like "Test - Text" in place of sParameter. When ...
2
votes
2answers
241 views

How do I convert named HTML entities to numeric HTML entities in javascript?

Following this question (I have the same problem), how do I convert a string that has entities like &nbsp; to a string those entities as &#160;, with javascript/jquery ?
2
votes
2answers
693 views

How can I have a prototype.js Template encode HTML entities?

If I have a prototype.js Template which generates HTML code from a JavaScript object, how can I have it automatically escape HTML entities in the JavaScript object's data so that the HTML doesn't ...
0
votes
1answer
506 views

GWT: setInnerHTML unescapes attribute values

This string: <a onclick="doit('&#39;')">...</a> is received from the server-side and needs to be set as the inner HTML of an element. When I use Element#setInnerHTML the string is ...
5
votes
5answers
2k views

PHP: HTML Attribute Encoding / JavaScript Decoding

What's the proper way to encode untrusted data for HTML attribute context? For example: <input type="hidden" value="<?php echo $data; ?>" /> I usually use htmlentities() or ...
3
votes
3answers
2k views

How to get char from HTML character code?

How can I convert the HTML entities &#8364; &#9658; &#9824; to their actual characters € ► ♠ using JavaScript?
0
votes
3answers
493 views

jQuery post() apostrophe how is apostrophe automatically converted to html numeric entity?

I am posting some data to the server using JQuery.post(), as shown below. When I receive the post data on the server side, I am surprised to see that the post variables already have single ...
1
vote
2answers
354 views

XSS and htmlentities

$text = "( = \" ' & \\ </textarea> : ; . " ; echo htmlentities($text); //outputs as -->> ( = &quot; ' &amp; \ &lt;/textarea&gt; : ; . //obviously, ...
0
votes
2answers
256 views

How to make JavaScript affect only the code between specific tags

This is the source of my simple HTML page (save as .html file): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html ...
2
votes
1answer
558 views

My JQuery fails to select table cells containing nonbreaking space `&nbsp;` or `&#160;`

Inspired from the post JQuery changing content of table cell , I am trying to modify the content of table cells containing a particular string which includes non breaking white spaces &nbsp; or ...
1
vote
2answers
1k views

JavaScript replace() one html entity with another

I want to get some textarea text and replace all bullet point html entities &#8226; with &#183;. The usual approach str.replace(/&#8226;/g,"&#183;"); doesn't work. Any advice would ...
0
votes
0answers
362 views

JS Html Entity Decoding (jquery 1.7.1)

With the latest update, the following code broke. It doesnt append the code in lb_l_ret.lbcode anymore. This code however, is html entities escaped. How can I make it work? Or how can I decode those ...
0
votes
1answer
484 views

How do I remove &nbsp; in IE?

I have some javascript code which removes non-breaking-space. It doesn't work in IE, however it does work in Chrome/FF/Safari. Wonder if someone can tell me why... ? <table id="shelf"> <tr ...
-2
votes
3answers
827 views

to replace “ ” with &nbsp;

this is my javascript code: mystring = "this is sample"; nestring = mystring.replace(/ /g,"&nbsp;"); I need nestring ouput "this is sample". but with the code above, nestring = ...
0
votes
2answers
243 views

JavaScript, Objective: Display Accurate Source Code

The objective is to be able to click a link to bring up a new window that displays the formatted source code from the parent window. Through research, I was able to accomplish most of the task, but I ...
0
votes
1answer
220 views

Javascript - how to encode special characters from text file for autopopulate text field

I have a text file that I get for my auto-populate textfield function. The problem is, how do I encode the contents of the text file so there will be no more special characters? please help...
0
votes
3answers
275 views

any javascript buildin function to convert html entity to pass from url

i have a value abc&#125;efg i need it to pass from URL in HTML &#125; = } in URL &#125; = %7D how to convert &#125; to %7D?
2
votes
1answer
762 views

Escaping content for placement with jQuery's .html() function

I need to accept arbitrary user input. Later, I want to copy that input, already escaped to HTML entities, into a textarea so it can be edited. However, jQuery's jQuery.html() function reads out the ...