Converting HTML entities to Unicode Characters in C#

I recommend using System.Net.WebUtility.HtmlDecode and NOT HttpUtility.HtmlDecode. This is due to the fact that the System.Web reference does not exist in Winforms/WPF/Console applications and you can get the exact same result using this class (which is already added as a reference in all those projects). Usage: string s = System.Net.WebUtility.HtmlDecode(“é”); // Returns é

How to Code Double Quotes via HTML Codes

There really aren’t any differences. " is processed as " which is the decimal equivalent of &x22; which is the ISO 8859-1 equivalent of “. The only reason you may be against using " is because it was mistakenly omitted from the HTML 3.2 specification. Otherwise it all boils down to personal preference.

What do the ENT_HTML5, ENT_HTML401, … modifiers on html_entity_decode do?

I started wondering what behavior these constants have when I saw these constants at the htmlspecialchars page. The documentation was rubbish, so I started digging in the source code of PHP. Basically, these constants affect whether certain entities are encoded or not (or decoded for html_entity_decode). The most obvious effect is whether the apostrophe (‘) … Read more

htmlentities in PHP but preserving html tags

You can get the list of correspondances character => entity used by htmlentities, with the function get_html_translation_table ; consider this code : $list = get_html_translation_table(HTML_ENTITIES); var_dump($list); (You might want to check the second parameter to that function in the manual — maybe you’ll need to set it to a value different than the default one) … Read more

Uses for the ‘"’ entity in HTML

It is impossible, and unnecessary, to know the motivation for using " in element content, but possible motives include: misunderstanding of HTML rules; use of software that generates such code (probably because its author thought it was “safer”); and misunderstanding of the meaning of ": many people seem to think it produces “smart quotes” (they … Read more

How to convert characters to HTML entities using plain JavaScript

With the help of bucabay and the advice to create my own function i created this one which works for me. What do you guys think, is there a better solution somewhere? if(typeof escapeHtmlEntities == ‘undefined’) { escapeHtmlEntities = function (text) { return text.replace(/[\u00A0-\u2666<>\&]/g, function(c) { return ‘&’ + (escapeHtmlEntities.entityTable[c.charCodeAt(0)] || ‘#’+c.charCodeAt(0)) + ‘;’; }); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)