Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://jsfiddle.net/b9EbY/3/" rel="nofollow">Fiddle Demo to get js file</a></p> <pre><code>function get_html_translation_table (table, quote_style) { var entities = {}, hash_map = {}, decimal; var constMappingTable = {}, constMappingQuoteStyle = {}; var useTable = {}, useQuoteStyle = {}; // Translate arguments constMappingTable[0] = 'HTML_SPECIALCHARS'; constMappingTable[1] = 'HTML_ENTITIES'; constMappingQuoteStyle[0] = 'ENT_NOQUOTES'; constMappingQuoteStyle[2] = 'ENT_COMPAT'; constMappingQuoteStyle[3] = 'ENT_QUOTES'; useTable = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS'; useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT'; if (useTable !== 'HTML_SPECIALCHARS' &amp;&amp; useTable !== 'HTML_ENTITIES') { throw new Error("Table: " + useTable + ' not supported'); // return false; } entities['38'] = '&amp;amp;'; if (useTable === 'HTML_ENTITIES') { entities['160'] = '&amp;nbsp;'; entities['161'] = '&amp;iexcl;'; entities['162'] = '&amp;cent;'; entities['163'] = '&amp;pound;'; entities['164'] = '&amp;curren;'; entities['165'] = '&amp;yen;'; entities['166'] = '&amp;brvbar;'; entities['167'] = '&amp;sect;'; entities['168'] = '&amp;uml;'; entities['169'] = '&amp;copy;'; entities['170'] = '&amp;ordf;'; entities['171'] = '&amp;laquo;'; entities['172'] = '&amp;not;'; entities['173'] = '&amp;shy;'; entities['174'] = '&amp;reg;'; entities['175'] = '&amp;macr;'; entities['176'] = '&amp;deg;'; entities['177'] = '&amp;plusmn;'; entities['178'] = '&amp;sup2;'; entities['179'] = '&amp;sup3;'; entities['180'] = '&amp;acute;'; entities['181'] = '&amp;micro;'; entities['182'] = '&amp;para;'; entities['183'] = '&amp;middot;'; entities['184'] = '&amp;cedil;'; entities['185'] = '&amp;sup1;'; entities['186'] = '&amp;ordm;'; entities['187'] = '&amp;raquo;'; entities['188'] = '&amp;frac14;'; entities['189'] = '&amp;frac12;'; entities['190'] = '&amp;frac34;'; entities['191'] = '&amp;iquest;'; entities['192'] = '&amp;Agrave;'; entities['193'] = '&amp;Aacute;'; entities['194'] = '&amp;Acirc;'; entities['195'] = '&amp;Atilde;'; entities['196'] = '&amp;Auml;'; entities['197'] = '&amp;Aring;'; entities['198'] = '&amp;AElig;'; entities['199'] = '&amp;Ccedil;'; entities['200'] = '&amp;Egrave;'; entities['201'] = '&amp;Eacute;'; entities['202'] = '&amp;Ecirc;'; entities['203'] = '&amp;Euml;'; entities['204'] = '&amp;Igrave;'; entities['205'] = '&amp;Iacute;'; entities['206'] = '&amp;Icirc;'; entities['207'] = '&amp;Iuml;'; entities['208'] = '&amp;ETH;'; entities['209'] = '&amp;Ntilde;'; entities['210'] = '&amp;Ograve;'; entities['211'] = '&amp;Oacute;'; entities['212'] = '&amp;Ocirc;'; entities['213'] = '&amp;Otilde;'; entities['214'] = '&amp;Ouml;'; entities['215'] = '&amp;times;'; entities['216'] = '&amp;Oslash;'; entities['217'] = '&amp;Ugrave;'; entities['218'] = '&amp;Uacute;'; entities['219'] = '&amp;Ucirc;'; entities['220'] = '&amp;Uuml;'; entities['221'] = '&amp;Yacute;'; entities['222'] = '&amp;THORN;'; entities['223'] = '&amp;szlig;'; entities['224'] = '&amp;agrave;'; entities['225'] = '&amp;aacute;'; entities['226'] = '&amp;acirc;'; entities['227'] = '&amp;atilde;'; entities['228'] = '&amp;auml;'; entities['229'] = '&amp;aring;'; entities['230'] = '&amp;aelig;'; entities['231'] = '&amp;ccedil;'; entities['232'] = '&amp;egrave;'; entities['233'] = '&amp;eacute;'; entities['234'] = '&amp;ecirc;'; entities['235'] = '&amp;euml;'; entities['236'] = '&amp;igrave;'; entities['237'] = '&amp;iacute;'; entities['238'] = '&amp;icirc;'; entities['239'] = '&amp;iuml;'; entities['240'] = '&amp;eth;'; entities['241'] = '&amp;ntilde;'; entities['242'] = '&amp;ograve;'; entities['243'] = '&amp;oacute;'; entities['244'] = '&amp;ocirc;'; entities['245'] = '&amp;otilde;'; entities['246'] = '&amp;ouml;'; entities['247'] = '&amp;divide;'; entities['248'] = '&amp;oslash;'; entities['249'] = '&amp;ugrave;'; entities['250'] = '&amp;uacute;'; entities['251'] = '&amp;ucirc;'; entities['252'] = '&amp;uuml;'; entities['253'] = '&amp;yacute;'; entities['254'] = '&amp;thorn;'; entities['255'] = '&amp;yuml;'; } if (useQuoteStyle !== 'ENT_NOQUOTES') { entities['34'] = '&amp;quot;'; } if (useQuoteStyle === 'ENT_QUOTES') { entities['39'] = '&amp;#39;'; } entities['60'] = '&amp;lt;'; entities['62'] = '&amp;gt;'; // ascii decimals to real symbols for (decimal in entities) { if (entities.hasOwnProperty(decimal)) { hash_map[String.fromCharCode(decimal)] = entities[decimal]; } } return hash_map; } function htmlentities (string, quote_style, charset, double_encode) { var hash_map = get_html_translation_table('HTML_ENTITIES', quote_style), symbol = ''; string = string == null ? '' : string + ''; if (!hash_map) { return false; } if (quote_style &amp;&amp; quote_style === 'ENT_QUOTES') { hash_map["'"] = '&amp;#039;'; } if (!!double_encode || double_encode == null) { for (symbol in hash_map) { if (hash_map.hasOwnProperty(symbol)) { string = string.split(symbol).join(hash_map[symbol]); } } } else { string = string.replace(/([\s\S]*?)(&amp;(?:#\d+|#x[\da-f]+|[a-zA-Z][\da-z]*);|$)/g, function (ignore, text, entity) { for (symbol in hash_map) { if (hash_map.hasOwnProperty(symbol)) { text = text.split(symbol).join(hash_map[symbol]); } } return text + entity; }); } return string; } $(function(){ $("#getjs").click(function(){ var url="http://fiddle.jshell.net/js/codemirror/lib/codemirror.js"; $.ajax({ url: url, beforeSend: function( xhr ) { xhr.overrideMimeType( "text/plain; charset=x-user-defined" ); } }) .done(function( data ) { $("#container").html("&lt;pre&gt;"+htmlentities(data) + "&lt;/pre&gt;") }); }); }) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload