src/com/adrianparr/utils/HtmlEntities.as
package com.adrianparr.utils
{
/**
* ...
* @author Adrian Parr
*/
public class HtmlEntities
{
public static function encode($str:String):String {
var regExp:RegExp;
///////////////////////////////////////////////////////////////////////
// Reserved Characters in HTML
// http://www.w3schools.com/tags/ref_entities.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/0026/index.htm
// ampersand (Entity Number: &)
regExp = /&/g;
$str = $str.replace(regExp, "&");
// http://www.fileformat.info/info/unicode/char/0022/index.htm
// double quotation mark (Entity Number: ")
regExp = /"/g;
$str = $str.replace(regExp, """);
// http://www.fileformat.info/info/unicode/char/0027/index.htm
// apostrophe (Entity Number: ')
regExp = /'/g;
$str = $str.replace(regExp, "'");
// http://www.fileformat.info/info/unicode/char/003c/index.htm
// less-than sign (Entity Number: <)
regExp = /</g;
$str = $str.replace(regExp, "<");
// http://www.fileformat.info/info/unicode/char/003e/index.htm
// greater-than sign (Entity Number: >)
regExp = />/g;
$str = $str.replace(regExp, ">");
///////////////////////////////////////////////////////////////////////
// ISO 8859-1 Symbols
// http://www.w3schools.com/tags/ref_entities.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/00a0/index.htm
// non-breaking space (Entity Number:  )
regExp = / /g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/00a1/index.htm
// inverted exclamation (Entity Number: ¡)
regExp = /¡/g;
$str = $str.replace(regExp, "¡");
// http://www.fileformat.info/info/unicode/char/00a2/index.htm
// cent sign (Entity Number: ¢)
regExp = /¢/g;
$str = $str.replace(regExp, "¢");
// http://www.fileformat.info/info/unicode/char/00a3/index.htm
// pound sterling (Entity Number: £)
regExp = /£/g;
$str = $str.replace(regExp, "£");
// http://www.fileformat.info/info/unicode/char/00a4/index.htm
// general currency sign (Entity Number: ¤)
regExp = /¤/g;
$str = $str.replace(regExp, "¤");
// http://www.fileformat.info/info/unicode/char/00a5/index.htm
// yen sign (Entity Number: ¥)
regExp = /¥/g;
$str = $str.replace(regExp, "¥");
// http://www.fileformat.info/info/unicode/char/00a6/index.htm
// broken vertical bar (Entity Number: ¦)
regExp = /¦/g;
$str = $str.replace(regExp, "¦");
// http://www.fileformat.info/info/unicode/char/00a7/index.htm
// section sign (Entity Number: §)
regExp = /§/g;
$str = $str.replace(regExp, "§");
// http://www.fileformat.info/info/unicode/char/00a8/index.htm
// umlaut (Entity Number: ¨)
regExp = /¨/g;
$str = $str.replace(regExp, "¨");
// http://www.fileformat.info/info/unicode/char/00a9/index.htm
// copyright (Entity Number: ©)
regExp = /©/g;
$str = $str.replace(regExp, "©");
// http://www.fileformat.info/info/unicode/char/00aa/index.htm
// feminine ordinal (Entity Number: ª)
regExp = /ª/g;
$str = $str.replace(regExp, "ª");
// http://www.fileformat.info/info/unicode/char/00ab/index.htm
// left angle quote (Entity Number: «)
regExp = /«/g;
$str = $str.replace(regExp, "«");
// http://www.fileformat.info/info/unicode/char/00ac/index.htm
// not sign (Entity Number: ¬)
regExp = /¬/g;
$str = $str.replace(regExp, "¬");
// http://www.fileformat.info/info/unicode/char/00ad/index.htm
// soft hyphen (Entity Number: ­)
//regExp = //g;
//$str = $str.replace(regExp, "­");
// http://www.fileformat.info/info/unicode/char/00ae/index.htm
// registered trademark (Entity Number: ®)
regExp = /®/g;
$str = $str.replace(regExp, "®");
// http://www.fileformat.info/info/unicode/char/00af/index.htm
// macron accent (Entity Number: ¯)
regExp = /¯/g;
$str = $str.replace(regExp, "¯");
// http://www.fileformat.info/info/unicode/char/00b0/index.htm
// degree sign (Entity Number: °)
regExp = /°/g;
$str = $str.replace(regExp, "°");
// http://www.fileformat.info/info/unicode/char/00b1/index.htm
// plus or minus (Entity Number: ±)
regExp = /±/g;
$str = $str.replace(regExp, "±");
// http://www.fileformat.info/info/unicode/char/00b2/index.htm
// superscript two (Entity Number: ²)
regExp = /²/g;
$str = $str.replace(regExp, "²");
// http://www.fileformat.info/info/unicode/char/00b3/index.htm
// superscript three (Entity Number: ³)
regExp = /³/g;
$str = $str.replace(regExp, "³");
// http://www.fileformat.info/info/unicode/char/00b4/index.htm
// acute accent (Entity Number: ´)
regExp = /´/g;
$str = $str.replace(regExp, "´");
// http://www.fileformat.info/info/unicode/char/00b5/index.htm
// micro sign (Entity Number: µ)
regExp = /µ/g;
$str = $str.replace(regExp, "µ");
// http://www.fileformat.info/info/unicode/char/00b6/index.htm
// paragraph sign (Entity Number: ¶)
regExp = /¶/g;
$str = $str.replace(regExp, "¶");
// http://www.fileformat.info/info/unicode/char/00b7/index.htm
// middle dot (Entity Number: ·)
regExp = /·/g;
$str = $str.replace(regExp, "·");
// http://www.fileformat.info/info/unicode/char/00b8/index.htm
// cedilla (Entity Number: ¸)
regExp = /¸/g;
$str = $str.replace(regExp, "¸");
// http://www.fileformat.info/info/unicode/char/00b9/index.htm
// superscript one (Entity Number: ¹)
regExp = /¹/g;
$str = $str.replace(regExp, "¹");
// http://www.fileformat.info/info/unicode/char/00ba/index.htm
// masculine ordinal (Entity Number: º)
regExp = /º/g;
$str = $str.replace(regExp, "º");
// http://www.fileformat.info/info/unicode/char/00bb/index.htm
// right angle quote (Entity Number: »)
regExp = /»/g;
$str = $str.replace(regExp, "»");
// http://www.fileformat.info/info/unicode/char/00bc/index.htm
// one-fourth (Entity Number: ¼)
regExp = /¼/g;
$str = $str.replace(regExp, "¼");
// http://www.fileformat.info/info/unicode/char/00bd/index.htm
// one-half (Entity Number: ½)
regExp = /½/g;
$str = $str.replace(regExp, "½");
// http://www.fileformat.info/info/unicode/char/00be/index.htm
// three-fourths (Entity Number: ¾)
regExp = /¾/g;
$str = $str.replace(regExp, "¾");
// http://www.fileformat.info/info/unicode/char/00bf/index.htm
// inverted question mark (Entity Number: ¿)
regExp = /¿/g;
$str = $str.replace(regExp, "¿");
// http://www.fileformat.info/info/unicode/char/00d7/index.htm
// multiplication sign (Entity Number: ×)
regExp = /×/g;
$str = $str.replace(regExp, "×");
// http://www.fileformat.info/info/unicode/char/00f7/index.htm
// division sign (Entity Number: ÷)
regExp = /÷/g;
$str = $str.replace(regExp, "÷");
///////////////////////////////////////////////////////////////////////
// ISO 8859-1 Characters
// http://www.w3schools.com/tags/ref_entities.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/00c0/index.htm
// uppercase A, grave accent (Entity Number: À)
regExp = /À/g;
$str = $str.replace(regExp, "À");
// http://www.fileformat.info/info/unicode/char/00c1/index.htm
// uppercase A, acute accent (Entity Number: Á)
regExp = /Á/g;
$str = $str.replace(regExp, "Á");
// http://www.fileformat.info/info/unicode/char/00c2/index.htm
// uppercase A, circumflex accent (Entity Number: Â)
regExp = /Â/g;
$str = $str.replace(regExp, "Â");
// http://www.fileformat.info/info/unicode/char/00c3/index.htm
// uppercase A, tilde (Entity Number: Ã)
regExp = /Ã/g;
$str = $str.replace(regExp, "Ã");
// http://www.fileformat.info/info/unicode/char/00c4/index.htm
// uppercase A, umlaut (Entity Number: Ä)
regExp = /Ä/g;
$str = $str.replace(regExp, "Ä");
// http://www.fileformat.info/info/unicode/char/00c5/index.htm
// uppercase A, ring (Entity Number: Å)
regExp = /Å/g;
$str = $str.replace(regExp, "Å");
// http://www.fileformat.info/info/unicode/char/00c6/index.htm
// uppercase AE (Entity Number: Æ)
regExp = /Æ/g;
$str = $str.replace(regExp, "Æ");
// http://www.fileformat.info/info/unicode/char/00c7/index.htm
// uppercase C, cedilla (Entity Number: Ç)
regExp = /Ç/g;
$str = $str.replace(regExp, "Ç");
// http://www.fileformat.info/info/unicode/char/00c8/index.htm
// uppercase E, grave accent (Entity Number: È)
regExp = /È/g;
$str = $str.replace(regExp, "È");
// http://www.fileformat.info/info/unicode/char/00c9/index.htm
// uppercase E, acute accent (Entity Number: É)
regExp = /É/g;
$str = $str.replace(regExp, "É");
// http://www.fileformat.info/info/unicode/char/00ca/index.htm
// uppercase E, circumflex accent (Entity Number: Ê)
regExp = /Ê/g;
$str = $str.replace(regExp, "Ê");
// http://www.fileformat.info/info/unicode/char/00cb/index.htm
// uppercase E, umlaut (Entity Number: Ë)
regExp = /Ë/g;
$str = $str.replace(regExp, "Ë");
// http://www.fileformat.info/info/unicode/char/00cc/index.htm
// uppercase I, grave accent (Entity Number: Ì)
regExp = /Ì/g;
$str = $str.replace(regExp, "Ì");
// http://www.fileformat.info/info/unicode/char/00cd/index.htm
// uppercase I, acute accent (Entity Number: Í)
regExp = /Í/g;
$str = $str.replace(regExp, "Í");
// http://www.fileformat.info/info/unicode/char/00ce/index.htm
// uppercase I, circumflex accent (Entity Number: Î)
regExp = /Î/g;
$str = $str.replace(regExp, "Î");
// http://www.fileformat.info/info/unicode/char/00cf/index.htm
// uppercase I, umlaut (Entity Number: Ï)
regExp = /Ï/g;
$str = $str.replace(regExp, "Ï");
// http://www.fileformat.info/info/unicode/char/00d0/index.htm
// uppercase Eth, Icelandic (Entity Number: Ð)
regExp = /Ð/g;
$str = $str.replace(regExp, "Ð");
// http://www.fileformat.info/info/unicode/char/00d1/index.htm
// uppercase N, tilde (Entity Number: Ñ)
regExp = /Ñ/g;
$str = $str.replace(regExp, "Ñ");
// http://www.fileformat.info/info/unicode/char/00d2/index.htm
// uppercase O, grave accent (Entity Number: Ò)
regExp = /Ò/g;
$str = $str.replace(regExp, "Ò");
// http://www.fileformat.info/info/unicode/char/00d3/index.htm
// uppercase O, acute accent (Entity Number: Ó)
regExp = /Ó/g;
$str = $str.replace(regExp, "Ó");
// http://www.fileformat.info/info/unicode/char/00d4/index.htm
// uppercase O, circumflex accent (Entity Number: Ô)
regExp = /Ô/g;
$str = $str.replace(regExp, "Ô");
// http://www.fileformat.info/info/unicode/char/00d5/index.htm
// uppercase O, tilde (Entity Number: Õ)
regExp = /Õ/g;
$str = $str.replace(regExp, "Õ");
// http://www.fileformat.info/info/unicode/char/00d6/index.htm
// uppercase O, umlaut (Entity Number: Ö)
regExp = /Ö/g;
$str = $str.replace(regExp, "Ö");
// http://www.fileformat.info/info/unicode/char/00d8/index.htm
// uppercase O, slash (Entity Number: Ø)
regExp = /Ø/g;
$str = $str.replace(regExp, "Ø");
// http://www.fileformat.info/info/unicode/char/00d9/index.htm
// uppercase U, grave accent (Entity Number: Ù)
regExp = /Ù/g;
$str = $str.replace(regExp, "Ù");
// http://www.fileformat.info/info/unicode/char/00da/index.htm
// uppercase U, acute accent (Entity Number: Ú)
regExp = /Ú/g;
$str = $str.replace(regExp, "Ú");
// http://www.fileformat.info/info/unicode/char/00db/index.htm
// uppercase U, circumflex accent (Entity Number: Û)
regExp = /Û/g;
$str = $str.replace(regExp, "Û");
// http://www.fileformat.info/info/unicode/char/00dc/index.htm
// uppercase U, umlaut (Entity Number: Ü)
regExp = /Ü/g;
$str = $str.replace(regExp, "Ü");
// http://www.fileformat.info/info/unicode/char/00dd/index.htm
// uppercase Y, acute accent (Entity Number: Ý)
regExp = /Ý/g;
$str = $str.replace(regExp, "Ý");
// http://www.fileformat.info/info/unicode/char/00de/index.htm
// uppercase THORN, Icelandic (Entity Number: Þ)
regExp = /Þ/g;
$str = $str.replace(regExp, "Þ");
// http://www.fileformat.info/info/unicode/char/00df/index.htm
// lowercase sharps, German (Entity Number: ß)
regExp = /ß/g;
$str = $str.replace(regExp, "ß");
// http://www.fileformat.info/info/unicode/char/00e0/index.htm
// lowercase a, grave accent (Entity Number: à)
regExp = /à/g;
$str = $str.replace(regExp, "à");
// http://www.fileformat.info/info/unicode/char/00e1/index.htm
// lowercase a, acute accent (Entity Number: á)
regExp = /á/g;
$str = $str.replace(regExp, "á");
// http://www.fileformat.info/info/unicode/char/00e2/index.htm
// lowercase a, circumflex accent (Entity Number: â)
regExp = /â/g;
$str = $str.replace(regExp, "â");
// http://www.fileformat.info/info/unicode/char/00e3/index.htm
// lowercase a, tilde (Entity Number: ã)
regExp = /ã/g;
$str = $str.replace(regExp, "ã");
// http://www.fileformat.info/info/unicode/char/00e4/index.htm
// lowercase a, umlaut (Entity Number: ä)
regExp = /ä/g;
$str = $str.replace(regExp, "ä");
// http://www.fileformat.info/info/unicode/char/00e5/index.htm
// lowercase a, ring (Entity Number: å)
regExp = /å/g;
$str = $str.replace(regExp, "å");
// http://www.fileformat.info/info/unicode/char/00e6/index.htm
// lowercase ae (Entity Number: æ)
regExp = /æ/g;
$str = $str.replace(regExp, "æ");
// http://www.fileformat.info/info/unicode/char/00e7/index.htm
// lowercase c, cedilla (Entity Number: ç)
regExp = /ç/g;
$str = $str.replace(regExp, "ç");
// http://www.fileformat.info/info/unicode/char/00e8/index.htm
// lowercase e, grave accent (Entity Number: è)
regExp = /è/g;
$str = $str.replace(regExp, "è");
// http://www.fileformat.info/info/unicode/char/00e9/index.htm
// lowercase e, acute accent (Entity Number: é)
regExp = /é/g;
$str = $str.replace(regExp, "é");
// http://www.fileformat.info/info/unicode/char/00ea/index.htm
// lowercase e, circumflex accent (Entity Number: ê)
regExp = /ê/g;
$str = $str.replace(regExp, "ê");
// http://www.fileformat.info/info/unicode/char/00eb/index.htm
// lowercase e, umlaut (Entity Number: ë)
regExp = /ë/g;
$str = $str.replace(regExp, "ë");
// http://www.fileformat.info/info/unicode/char/00ec/index.htm
// lowercase i, grave accent (Entity Number: ì)
regExp = /ì/g;
$str = $str.replace(regExp, "ì");
// http://www.fileformat.info/info/unicode/char/00ed/index.htm
// lowercase i, acute accent (Entity Number: í)
regExp = /í/g;
$str = $str.replace(regExp, "í");
// http://www.fileformat.info/info/unicode/char/00ee/index.htm
// lowercase i, circumflex accent (Entity Number: î)
regExp = /î/g;
$str = $str.replace(regExp, "î");
// http://www.fileformat.info/info/unicode/char/00ef/index.htm
// lowercase i, umlaut (Entity Number: ï)
regExp = /ï/g;
$str = $str.replace(regExp, "ï");
// http://www.fileformat.info/info/unicode/char/00f0/index.htm
// lowercase eth, Icelandic (Entity Number: ð)
regExp = /ð/g;
$str = $str.replace(regExp, "ð");
// http://www.fileformat.info/info/unicode/char/00f1/index.htm
// lowercase n, tilde (Entity Number: ñ)
regExp = /ñ/g;
$str = $str.replace(regExp, "ñ");
// http://www.fileformat.info/info/unicode/char/00f2/index.htm
// lowercase o, grave accent (Entity Number: ò)
regExp = /ò/g;
$str = $str.replace(regExp, "ò");
// http://www.fileformat.info/info/unicode/char/00f3/index.htm
// lowercase o, acute accent (Entity Number: ó)
regExp = /ó/g;
$str = $str.replace(regExp, "ó");
// http://www.fileformat.info/info/unicode/char/00f4/index.htm
// lowercase o, circumflex accent (Entity Number: ô)
regExp = /ô/g;
$str = $str.replace(regExp, "ô");
// http://www.fileformat.info/info/unicode/char/00f5/index.htm
// lowercase o, tilde (Entity Number: õ)
regExp = /õ/g;
$str = $str.replace(regExp, "õ");
// http://www.fileformat.info/info/unicode/char/00f6/index.htm
// lowercase o, umlaut (Entity Number: ö)
regExp = /ö/g;
$str = $str.replace(regExp, "ö");
// http://www.fileformat.info/info/unicode/char/00f8/index.htm
// lowercase o, slash (Entity Number: ø)
regExp = /ø/g;
$str = $str.replace(regExp, "ø");
// http://www.fileformat.info/info/unicode/char/00f9/index.htm
// lowercase u, grave accent (Entity Number: ù)
regExp = /ù/g;
$str = $str.replace(regExp, "ù");
// http://www.fileformat.info/info/unicode/char/00fa/index.htm
// lowercase u, acute accent (Entity Number: ú)
regExp = /ú/g;
$str = $str.replace(regExp, "ú");
// http://www.fileformat.info/info/unicode/char/00fb/index.htm
// lowercase u, circumflex accent (Entity Number: û)
regExp = /û/g;
$str = $str.replace(regExp, "û");
// http://www.fileformat.info/info/unicode/char/00fc/index.htm
// lowercase u, umlaut (Entity Number: ü)
regExp = /ü/g;
$str = $str.replace(regExp, "ü");
// http://www.fileformat.info/info/unicode/char/00fd/index.htm
// lowercase y, acute accent (Entity Number: ý)
regExp = /ý/g;
$str = $str.replace(regExp, "ý");
// http://www.fileformat.info/info/unicode/char/00fe/index.htm
// lowercase thorn, Icelandic (Entity Number: þ)
regExp = /þ/g;
$str = $str.replace(regExp, "þ");
// http://www.fileformat.info/info/unicode/char/00ff/index.htm
// lowercase y, umlaut (Entity Number: ÿ)
regExp = /ÿ/g;
$str = $str.replace(regExp, "ÿ");
///////////////////////////////////////////////////////////////////////
// Math Symbols Supported by HTML
// http://www.w3schools.com/tags/ref_symbols.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/2200/index.htm
// for all (Entity Number: ∀)
regExp = /∀/g;
$str = $str.replace(regExp, "∀");
// http://www.fileformat.info/info/unicode/char/2202/index.htm
// part (Entity Number: ∂)
regExp = /∂/g;
$str = $str.replace(regExp, "∂");
// http://www.fileformat.info/info/unicode/char/2203/index.htm
// exists (Entity Number: ∃)
regExp = /∃/g;
$str = $str.replace(regExp, "∃");
// http://www.fileformat.info/info/unicode/char/2205/index.htm
// empty (Entity Number: ∅)
regExp = /∅/g;
$str = $str.replace(regExp, "∅");
// http://www.fileformat.info/info/unicode/char/2207/index.htm
// nabla (Entity Number: ∇)
regExp = /∇/g;
$str = $str.replace(regExp, "∇");
// http://www.fileformat.info/info/unicode/char/2208/index.htm
// isin (Entity Number: ∈)
regExp = /∈/g;
$str = $str.replace(regExp, "∈");
// http://www.fileformat.info/info/unicode/char/2209/index.htm
// notin (Entity Number: ∉)
regExp = /∉/g;
$str = $str.replace(regExp, "∉");
// http://www.fileformat.info/info/unicode/char/220b/index.htm
// ni (Entity Number: ∋)
regExp = /∋/g;
$str = $str.replace(regExp, "∋");
// http://www.fileformat.info/info/unicode/char/220f/index.htm
// prod (Entity Number: ∏)
regExp = /∏/g;
$str = $str.replace(regExp, "∏");
// http://www.fileformat.info/info/unicode/char/2211/index.htm
// sum (Entity Number: ∑)
regExp = /∑/g;
$str = $str.replace(regExp, "∑");
// http://www.fileformat.info/info/unicode/char/2212/index.htm
// minus (Entity Number: −)
regExp = /−/g;
$str = $str.replace(regExp, "−");
// http://www.fileformat.info/info/unicode/char/2217/index.htm
// lowast (Entity Number: ∗)
regExp = /∗/g;
$str = $str.replace(regExp, "∗");
// http://www.fileformat.info/info/unicode/char/221a/index.htm
// square root (Entity Number: √)
regExp = /√/g;
$str = $str.replace(regExp, "√");
// http://www.fileformat.info/info/unicode/char/221d/index.htm
// proportional to (Entity Number: ∝)
regExp = /∝/g;
$str = $str.replace(regExp, "∝");
// http://www.fileformat.info/info/unicode/char/221e/index.htm
// infinity (Entity Number: ∞)
regExp = /∞/g;
$str = $str.replace(regExp, "∞");
// http://www.fileformat.info/info/unicode/char/2220/index.htm
// angle (Entity Number: ∠)
regExp = /∠/g;
$str = $str.replace(regExp, "∠");
// http://www.fileformat.info/info/unicode/char/2227/index.htm
// and (Entity Number: ∧)
regExp = /∧/g;
$str = $str.replace(regExp, "∧");
// http://www.fileformat.info/info/unicode/char/2228/index.htm
// or (Entity Number: ∨)
regExp = /∨/g;
$str = $str.replace(regExp, "∨");
// http://www.fileformat.info/info/unicode/char/2229/index.htm
// cap (Entity Number: ∩)
regExp = /∩/g;
$str = $str.replace(regExp, "∩");
// http://www.fileformat.info/info/unicode/char/222a/index.htm
// cup (Entity Number: ∪)
regExp = /∪/g;
$str = $str.replace(regExp, "∪");
// http://www.fileformat.info/info/unicode/char/222b/index.htm
// integral (Entity Number: ∫)
regExp = /∫/g;
$str = $str.replace(regExp, "∫");
// http://www.fileformat.info/info/unicode/char/2234/index.htm
// therefore (Entity Number: ∴)
regExp = /∴/g;
$str = $str.replace(regExp, "∴");
// http://www.fileformat.info/info/unicode/char/223c/index.htm
// similar to (Entity Number: ∼)
regExp = /∼/g;
$str = $str.replace(regExp, "∼");
// http://www.fileformat.info/info/unicode/char/2245/index.htm
// congruent to (Entity Number: ≅)
regExp = /≅/g;
$str = $str.replace(regExp, "≅");
// http://www.fileformat.info/info/unicode/char/2248/index.htm
// almost equal (Entity Number: ≈)
regExp = /≈/g;
$str = $str.replace(regExp, "≈");
// http://www.fileformat.info/info/unicode/char/2260/index.htm
// not equal (Entity Number: ≠)
regExp = /≠/g;
$str = $str.replace(regExp, "≠");
// http://www.fileformat.info/info/unicode/char/2261/index.htm
// equivalent (Entity Number: ≡)
regExp = /≡/g;
$str = $str.replace(regExp, "≡");
// http://www.fileformat.info/info/unicode/char/2264/index.htm
// less or equal (Entity Number: ≤)
regExp = /≤/g;
$str = $str.replace(regExp, "≤");
// http://www.fileformat.info/info/unicode/char/2265/index.htm
// greater or equal (Entity Number: ≥)
regExp = /≥/g;
$str = $str.replace(regExp, "≥");
// http://www.fileformat.info/info/unicode/char/2282/index.htm
// subset of (Entity Number: ⊂)
regExp = /⊂/g;
$str = $str.replace(regExp, "⊂");
// http://www.fileformat.info/info/unicode/char/2283/index.htm
// superset of (Entity Number: ⊃)
regExp = /⊃/g;
$str = $str.replace(regExp, "⊃");
// http://www.fileformat.info/info/unicode/char/2284/index.htm
// not subset of (Entity Number: ⊄)
regExp = /⊄/g;
$str = $str.replace(regExp, "⊄");
// http://www.fileformat.info/info/unicode/char/2286/index.htm
// subset or equal (Entity Number: ⊆)
regExp = /⊆/g;
$str = $str.replace(regExp, "⊆");
// http://www.fileformat.info/info/unicode/char/2287/index.htm
// superset or equal (Entity Number: ⊇)
regExp = /⊇/g;
$str = $str.replace(regExp, "⊇");
// http://www.fileformat.info/info/unicode/char/2295/index.htm
// circled plus (Entity Number: ⊕)
regExp = /⊕/g;
$str = $str.replace(regExp, "⊕");
// http://www.fileformat.info/info/unicode/char/2297/index.htm
// cirled times (Entity Number: ⊗)
regExp = /⊗/g;
$str = $str.replace(regExp, "⊗");
// http://www.fileformat.info/info/unicode/char/22a5/index.htm
// perpendicular (Entity Number: ⊥)
regExp = /⊥/g;
$str = $str.replace(regExp, "⊥");
// http://www.fileformat.info/info/unicode/char/22c5/index.htm
// dot operator (Entity Number: ⋅)
regExp = /⋅/g;
$str = $str.replace(regExp, "⋅");
///////////////////////////////////////////////////////////////////////
// Greek Letters Supported by HTML
// http://www.w3schools.com/tags/ref_symbols.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/0391/index.htm
// Alpha (Entity Number: Α)
regExp = /Α/g;
$str = $str.replace(regExp, "Α");
// http://www.fileformat.info/info/unicode/char/0392/index.htm
// Beta (Entity Number: Β)
regExp = /Β/g;
$str = $str.replace(regExp, "Β");
// http://www.fileformat.info/info/unicode/char/0393/index.htm
// Gamma (Entity Number: Γ)
regExp = /Γ/g;
$str = $str.replace(regExp, "Γ");
// http://www.fileformat.info/info/unicode/char/0394/index.htm
// Delta (Entity Number: Δ)
regExp = /Δ/g;
$str = $str.replace(regExp, "Δ");
// http://www.fileformat.info/info/unicode/char/0395/index.htm
// Epsilon (Entity Number: Ε)
regExp = /Ε/g;
$str = $str.replace(regExp, "Ε");
// http://www.fileformat.info/info/unicode/char/0396/index.htm
// Zeta (Entity Number: Ζ)
regExp = /Ζ/g;
$str = $str.replace(regExp, "Ζ");
// http://www.fileformat.info/info/unicode/char/0397/index.htm
// Eta (Entity Number: Η)
regExp = /Η/g;
$str = $str.replace(regExp, "Η");
// http://www.fileformat.info/info/unicode/char/0398/index.htm
// Theta (Entity Number: Θ)
regExp = /Θ/g;
$str = $str.replace(regExp, "Θ");
// http://www.fileformat.info/info/unicode/char/0399/index.htm
// Iota (Entity Number: Ι)
regExp = /Ι/g;
$str = $str.replace(regExp, "Ι");
// http://www.fileformat.info/info/unicode/char/039a/index.htm
// Kappa (Entity Number: Κ)
regExp = /Κ/g;
$str = $str.replace(regExp, "Κ");
// http://www.fileformat.info/info/unicode/char/039b/index.htm
// Lambda (Entity Number: Λ)
regExp = /Λ/g;
$str = $str.replace(regExp, "Λ");
// http://www.fileformat.info/info/unicode/char/039c/index.htm
// Mu (Entity Number: Μ)
regExp = /Μ/g;
$str = $str.replace(regExp, "Μ");
// http://www.fileformat.info/info/unicode/char/039d/index.htm
// Nu (Entity Number: Ν)
regExp = /Ν/g;
$str = $str.replace(regExp, "Ν");
// http://www.fileformat.info/info/unicode/char/039e/index.htm
// Xi (Entity Number: Ξ)
regExp = /Ξ/g;
$str = $str.replace(regExp, "Ξ");
// http://www.fileformat.info/info/unicode/char/039f/index.htm
// Omicron (Entity Number: Ο)
regExp = /Ο/g;
$str = $str.replace(regExp, "Ο");
// http://www.fileformat.info/info/unicode/char/03a0/index.htm
// Pi (Entity Number: Π)
regExp = /Π/g;
$str = $str.replace(regExp, "Π");
// http://www.fileformat.info/info/unicode/char/03a1/index.htm
// Rho (Entity Number: Ρ)
regExp = /Ρ/g;
$str = $str.replace(regExp, "Ρ");
// http://www.fileformat.info/info/unicode/char/03a3/index.htm
// Sigma (Entity Number: Σ)
regExp = /Σ/g;
$str = $str.replace(regExp, "Σ");
// http://www.fileformat.info/info/unicode/char/03a4/index.htm
// Tau (Entity Number: Τ)
regExp = /Τ/g;
$str = $str.replace(regExp, "Τ");
// http://www.fileformat.info/info/unicode/char/03a5/index.htm
// Upsilon (Entity Number: Υ)
regExp = /Υ/g;
$str = $str.replace(regExp, "Υ");
// http://www.fileformat.info/info/unicode/char/03a6/index.htm
// Phi (Entity Number: Φ)
regExp = /Φ/g;
$str = $str.replace(regExp, "Φ");
// http://www.fileformat.info/info/unicode/char/03a7/index.htm
// Chi (Entity Number: Χ)
regExp = /Χ/g;
$str = $str.replace(regExp, "Χ");
// http://www.fileformat.info/info/unicode/char/03a8/index.htm
// Psi (Entity Number: Ψ)
regExp = /Ψ/g;
$str = $str.replace(regExp, "Ψ");
// http://www.fileformat.info/info/unicode/char/03a9/index.htm
// Omega (Entity Number: Ω)
regExp = /Ω/g;
$str = $str.replace(regExp, "Ω");
// http://www.fileformat.info/info/unicode/char/03b1/index.htm
// alpha (Entity Number: α)
regExp = /α/g;
$str = $str.replace(regExp, "α");
// http://www.fileformat.info/info/unicode/char/03b2/index.htm
// beta (Entity Number: β)
regExp = /β/g;
$str = $str.replace(regExp, "β");
// http://www.fileformat.info/info/unicode/char/03b3/index.htm
// gamma (Entity Number: γ)
regExp = /γ/g;
$str = $str.replace(regExp, "γ");
// http://www.fileformat.info/info/unicode/char/03b4/index.htm
// delta (Entity Number: δ)
regExp = /δ/g;
$str = $str.replace(regExp, "δ");
// http://www.fileformat.info/info/unicode/char/03b5/index.htm
// epsilon (Entity Number: ε)
regExp = /ε/g;
$str = $str.replace(regExp, "ε");
// http://www.fileformat.info/info/unicode/char/03b6/index.htm
// zeta (Entity Number: ζ)
regExp = /ζ/g;
$str = $str.replace(regExp, "ζ");
// http://www.fileformat.info/info/unicode/char/03b7/index.htm
// eta (Entity Number: η)
regExp = /η/g;
$str = $str.replace(regExp, "η");
// http://www.fileformat.info/info/unicode/char/03b8/index.htm
// theta (Entity Number: θ)
regExp = /θ/g;
$str = $str.replace(regExp, "θ");
// http://www.fileformat.info/info/unicode/char/03b9/index.htm
// iota (Entity Number: ι)
regExp = /ι/g;
$str = $str.replace(regExp, "ι");
// http://www.fileformat.info/info/unicode/char/03ba/index.htm
// kappa (Entity Number: κ)
regExp = /κ/g;
$str = $str.replace(regExp, "κ");
// http://www.fileformat.info/info/unicode/char/03bb/index.htm
// lambda (Entity Number: λ)
regExp = /λ/g;
$str = $str.replace(regExp, "λ");
// http://www.fileformat.info/info/unicode/char/03bc/index.htm
// mu (Entity Number: μ)
regExp = /μ/g;
$str = $str.replace(regExp, "μ");
// http://www.fileformat.info/info/unicode/char/03bd/index.htm
// nu (Entity Number: ν)
regExp = /ν/g;
$str = $str.replace(regExp, "ν");
// http://www.fileformat.info/info/unicode/char/03be/index.htm
// xi (Entity Number: ξ)
regExp = /ξ/g;
$str = $str.replace(regExp, "ξ");
// http://www.fileformat.info/info/unicode/char/03bf/index.htm
// omicron (Entity Number: ο)
regExp = /ο/g;
$str = $str.replace(regExp, "ο");
// http://www.fileformat.info/info/unicode/char/03c0/index.htm
// pi (Entity Number: π)
regExp = /π/g;
$str = $str.replace(regExp, "π");
// http://www.fileformat.info/info/unicode/char/03c1/index.htm
// rho (Entity Number: ρ)
regExp = /ρ/g;
$str = $str.replace(regExp, "ρ");
// http://www.fileformat.info/info/unicode/char/03c2/index.htm
// sigmaf (Entity Number: ς)
regExp = /ς/g;
$str = $str.replace(regExp, "ς");
// http://www.fileformat.info/info/unicode/char/03c3/index.htm
// sigma (Entity Number: σ)
regExp = /σ/g;
$str = $str.replace(regExp, "σ");
// http://www.fileformat.info/info/unicode/char/03c4/index.htm
// tau (Entity Number: τ)
regExp = /τ/g;
$str = $str.replace(regExp, "τ");
// http://www.fileformat.info/info/unicode/char/03c5/index.htm
// upsilon (Entity Number: υ)
regExp = /υ/g;
$str = $str.replace(regExp, "υ");
// http://www.fileformat.info/info/unicode/char/03c6/index.htm
// phi (Entity Number: φ)
regExp = /φ/g;
$str = $str.replace(regExp, "φ");
// http://www.fileformat.info/info/unicode/char/03c7/index.htm
// chi (Entity Number: χ)
regExp = /χ/g;
$str = $str.replace(regExp, "χ");
// http://www.fileformat.info/info/unicode/char/03c8/index.htm
// psi (Entity Number: ψ)
regExp = /ψ/g;
$str = $str.replace(regExp, "ψ");
// http://www.fileformat.info/info/unicode/char/03c9/index.htm
// omega (Entity Number: ω)
regExp = /ω/g;
$str = $str.replace(regExp, "ω");
// http://www.fileformat.info/info/unicode/char/03d1/index.htm
// theta symbol (Entity Number: ϑ)
regExp = /ϑ/g;
$str = $str.replace(regExp, "ϑ");
// http://www.fileformat.info/info/unicode/char/03d2/index.htm
// upsilon symbol (Entity Number: ϒ)
regExp = /ϒ/g;
$str = $str.replace(regExp, "ϒ");
// http://www.fileformat.info/info/unicode/char/03d6/index.htm
// pi symbol (Entity Number: ϖ)
regExp = /ϖ/g;
$str = $str.replace(regExp, "ϖ");
///////////////////////////////////////////////////////////////////////
// Other Entities Supported by HTML
// http://www.w3schools.com/tags/ref_symbols.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/0152/index.htm
// capital ligature OE (Entity Number: Œ)
regExp = /Œ/g;
$str = $str.replace(regExp, "Œ");
// http://www.fileformat.info/info/unicode/char/0153/index.htm
// small ligature oe (Entity Number: œ)
regExp = /œ/g;
$str = $str.replace(regExp, "œ");
// http://www.fileformat.info/info/unicode/char/0160/index.htm
// capital S with caron (Entity Number: Š)
regExp = /Š/g;
$str = $str.replace(regExp, "Š");
// http://www.fileformat.info/info/unicode/char/0161/index.htm
// small S with caron (Entity Number: š)
regExp = /š/g;
$str = $str.replace(regExp, "š");
// http://www.fileformat.info/info/unicode/char/0178/index.htm
// capital Y with diaeres (Entity Number: Ÿ)
regExp = /Ÿ/g;
$str = $str.replace(regExp, "Ÿ");
// http://www.fileformat.info/info/unicode/char/0192/index.htm
// f with hook (Entity Number: ƒ)
regExp = /ƒ/g;
$str = $str.replace(regExp, "ƒ");
// http://www.fileformat.info/info/unicode/char/02c6/index.htm
// modifier letter circumflex accent (Entity Number: ˆ)
regExp = /ˆ/g;
$str = $str.replace(regExp, "ˆ");
// http://www.fileformat.info/info/unicode/char/02dc/index.htm
// small tilde (Entity Number: ˜)
regExp = /˜/g;
$str = $str.replace(regExp, "˜");
// http://www.fileformat.info/info/unicode/char/2002/index.htm
// en space (Entity Number:  )
regExp = / /g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/2003/index.htm
// em space (Entity Number:  )
regExp = / /g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/2009/index.htm
// thin space (Entity Number:  )
regExp = / /g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/200c/index.htm
// zero width non-joiner (Entity Number: ‌)
//regExp = //g;
//$str = $str.replace(regExp, "‌");
// http://www.fileformat.info/info/unicode/char/200d/index.htm
// zero width joiner (Entity Number: ‍)
//regExp = //g;
//$str = $str.replace(regExp, "‍");
// http://www.fileformat.info/info/unicode/char/200e/index.htm
// left-to-right mark (Entity Number: ‎)
regExp = / /g;
$str = $str.replace(regExp, "‎");
// http://www.fileformat.info/info/unicode/char/200f/index.htm
// right-to-left mark (Entity Number: ‏)
regExp = / /g;
$str = $str.replace(regExp, "‏");
// http://www.fileformat.info/info/unicode/char/2013/index.htm
// en dash (Entity Number: –)
regExp = /–/g;
$str = $str.replace(regExp, "–");
// http://www.fileformat.info/info/unicode/char/2014/index.htm
// em dash (Entity Number: —)
regExp = /—/g;
$str = $str.replace(regExp, "—");
// http://www.fileformat.info/info/unicode/char/2018/index.htm
// left single quote (Entity Number: ‘)
regExp = /‘/g;
$str = $str.replace(regExp, "‘");
// http://www.fileformat.info/info/unicode/char/2019/index.htm
// right single quote (Entity Number: ’)
regExp = /’/g;
$str = $str.replace(regExp, "’");
// http://www.fileformat.info/info/unicode/char/201a/index.htm
// single low-9 quote (Entity Number: ‚)
regExp = /‚/g;
$str = $str.replace(regExp, "‚");
// http://www.fileformat.info/info/unicode/char/201c/index.htm
// left double quote (Entity Number: “)
regExp = /“/g;
$str = $str.replace(regExp, "“");
// http://www.fileformat.info/info/unicode/char/201d/index.htm
// right double quote (Entity Number: ”)
regExp = /”/g;
$str = $str.replace(regExp, "”");
// http://www.fileformat.info/info/unicode/char/201e/index.htm
// double low-9 quote (Entity Number: „)
regExp = /„/g;
$str = $str.replace(regExp, "„");
// http://www.fileformat.info/info/unicode/char/2020/index.htm
// dagger (Entity Number: †)
regExp = /†/g;
$str = $str.replace(regExp, "†");
// http://www.fileformat.info/info/unicode/char/2021/index.htm
// double dagger (Entity Number: ‡)
regExp = /‡/g;
$str = $str.replace(regExp, "‡");
// http://www.fileformat.info/info/unicode/char/2022/index.htm
// bullet (Entity Number: •)
regExp = /•/g;
$str = $str.replace(regExp, "•");
// http://www.fileformat.info/info/unicode/char/2026/index.htm
// horizontal ellipsis (Entity Number: …)
regExp = /…/g;
$str = $str.replace(regExp, "…");
// http://www.fileformat.info/info/unicode/char/2030/index.htm
// per mill sign (Entity Number: ‰)
regExp = /‰/g;
$str = $str.replace(regExp, "‰");
// http://www.fileformat.info/info/unicode/char/2032/index.htm
// minutes (Entity Number: ′)
regExp = /′/g;
$str = $str.replace(regExp, "′");
// http://www.fileformat.info/info/unicode/char/2033/index.htm
// seconds (Entity Number: ″)
regExp = /″/g;
$str = $str.replace(regExp, "″");
// http://www.fileformat.info/info/unicode/char/2039/index.htm
// single left-pointing angle quote (Entity Number: ‹)
regExp = /‹/g;
$str = $str.replace(regExp, "‹");
// http://www.fileformat.info/info/unicode/char/203a/index.htm
// single right-pointing angle quote (Entity Number: ›)
regExp = /›/g;
$str = $str.replace(regExp, "›");
// http://www.fileformat.info/info/unicode/char/203e/index.htm
// overline, = spacing overscore (Entity Number: ‾)
regExp = /‾/g;
$str = $str.replace(regExp, "‾");
// http://www.fileformat.info/info/unicode/char/20ac/index.htm
// euro (Entity Number: €)
regExp = /€/g;
$str = $str.replace(regExp, "€");
// http://www.fileformat.info/info/unicode/char/2122/index.htm
// trademark sign (Entity Number: ™)
regExp = /™/g;
$str = $str.replace(regExp, "™");
// http://www.fileformat.info/info/unicode/char/2190/index.htm
// leftward arrow (Entity Number: ←)
regExp = /←/g;
$str = $str.replace(regExp, "←");
// http://www.fileformat.info/info/unicode/char/2191/index.htm
// upward arrow (Entity Number: ↑)
regExp = /↑/g;
$str = $str.replace(regExp, "↑");
// http://www.fileformat.info/info/unicode/char/2192/index.htm
// rightward arrow (Entity Number: →)
regExp = /→/g;
$str = $str.replace(regExp, "→");
// http://www.fileformat.info/info/unicode/char/2193/index.htm
// downward arrow (Entity Number: ↓)
regExp = /↓/g;
$str = $str.replace(regExp, "↓");
// http://www.fileformat.info/info/unicode/char/2194/index.htm
// left right arrow (Entity Number: ↔)
regExp = /↔/g;
$str = $str.replace(regExp, "↔");
// http://www.fileformat.info/info/unicode/char/21b5/index.htm
// carriage return arrow (Entity Number: ↵)
regExp = /↵/g;
$str = $str.replace(regExp, "↵");
// http://www.fileformat.info/info/unicode/char/2308/index.htm
// left ceiling (Entity Number: ⌈)
regExp = /⌈/g;
$str = $str.replace(regExp, "⌈");
// http://www.fileformat.info/info/unicode/char/2309/index.htm
// right ceiling (Entity Number: ⌉)
regExp = /⌉/g;
$str = $str.replace(regExp, "⌉");
// http://www.fileformat.info/info/unicode/char/230a/index.htm
// left floor (Entity Number: ⌊)
regExp = /⌊/g;
$str = $str.replace(regExp, "⌊");
// http://www.fileformat.info/info/unicode/char/230b/index.htm
// right floor (Entity Number: ⌋)
regExp = /⌋/g;
$str = $str.replace(regExp, "⌋");
// http://www.fileformat.info/info/unicode/char/25ca/index.htm
// lozenge (Entity Number: ◊)
regExp = /◊/g;
$str = $str.replace(regExp, "◊");
// http://www.fileformat.info/info/unicode/char/2660/index.htm
// black spade suit (Entity Number: ♠)
regExp = /♠/g;
$str = $str.replace(regExp, "♠");
// http://www.fileformat.info/info/unicode/char/2663/index.htm
// black club suit (Entity Number: ♣)
regExp = /♣/g;
$str = $str.replace(regExp, "♣");
// http://www.fileformat.info/info/unicode/char/2665/index.htm
// black heart suit (Entity Number: ♥)
regExp = /♥/g;
$str = $str.replace(regExp, "♥");
// http://www.fileformat.info/info/unicode/char/2666/index.htm
// black diamond suit (Entity Number: ♦)
regExp = /♦/g;
$str = $str.replace(regExp, "♦");
///////////////////////////////////////////////////////////////////////
// Other Named Entities
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/002f/index.htm
// slash (Entity Number: /)
regExp = /\//g;
$str = $str.replace(regExp, "⁄");
///////////////////////////////////////////////////////////////////////
return $str;
}
public static function decode($str:String):String {
var regExp:RegExp;
///////////////////////////////////////////////////////////////////////
// Reserved Characters in HTML
// http://www.w3schools.com/tags/ref_entities.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/0026/index.htm
// ampersand (Entity Number: &)
regExp = /&/g;
$str = $str.replace(regExp, "&");
// http://www.fileformat.info/info/unicode/char/0022/index.htm
// double quotation mark (Entity Number: ")
regExp = /"/g;
$str = $str.replace(regExp, "\"");
// http://www.fileformat.info/info/unicode/char/0027/index.htm
// apostrophe (Entity Number: ')
regExp = /'/g;
$str = $str.replace(regExp, "'");
// http://www.fileformat.info/info/unicode/char/003c/index.htm
// less-than sign (Entity Number: <)
regExp = /</g;
$str = $str.replace(regExp, "<");
// http://www.fileformat.info/info/unicode/char/003e/index.htm
// greater-than sign (Entity Number: >)
regExp = />/g;
$str = $str.replace(regExp, ">");
///////////////////////////////////////////////////////////////////////
// ISO 8859-1 Symbols
// http://www.w3schools.com/tags/ref_entities.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/00a0/index.htm
// non-breaking space (Entity Number:  )
regExp = / /g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/00a1/index.htm
// inverted exclamation (Entity Number: ¡)
regExp = /¡/g;
$str = $str.replace(regExp, "¡");
// http://www.fileformat.info/info/unicode/char/00a2/index.htm
// cent sign (Entity Number: ¢)
regExp = /¢/g;
$str = $str.replace(regExp, "¢");
// http://www.fileformat.info/info/unicode/char/00a3/index.htm
// pound sterling (Entity Number: £)
regExp = /£/g;
$str = $str.replace(regExp, "£");
// http://www.fileformat.info/info/unicode/char/00a4/index.htm
// general currency sign (Entity Number: ¤)
regExp = /¤/g;
$str = $str.replace(regExp, "¤");
// http://www.fileformat.info/info/unicode/char/00a5/index.htm
// yen sign (Entity Number: ¥)
regExp = /¥/g;
$str = $str.replace(regExp, "¥");
// http://www.fileformat.info/info/unicode/char/00a6/index.htm
// broken vertical bar (Entity Number: ¦)
regExp = /¦/g;
$str = $str.replace(regExp, "¦");
// http://www.fileformat.info/info/unicode/char/00a7/index.htm
// section sign (Entity Number: §)
regExp = /§/g;
$str = $str.replace(regExp, "§");
// http://www.fileformat.info/info/unicode/char/00a8/index.htm
// umlaut (Entity Number: ¨)
regExp = /¨/g;
$str = $str.replace(regExp, "¨");
// http://www.fileformat.info/info/unicode/char/00a9/index.htm
// copyright (Entity Number: ©)
regExp = /©/g;
$str = $str.replace(regExp, "©");
// http://www.fileformat.info/info/unicode/char/00aa/index.htm
// feminine ordinal (Entity Number: ª)
regExp = /ª/g;
$str = $str.replace(regExp, "ª");
// http://www.fileformat.info/info/unicode/char/00ab/index.htm
// left angle quote (Entity Number: «)
regExp = /«/g;
$str = $str.replace(regExp, "«");
// http://www.fileformat.info/info/unicode/char/00ac/index.htm
// not sign (Entity Number: ¬)
regExp = /¬/g;
$str = $str.replace(regExp, "¬");
// http://www.fileformat.info/info/unicode/char/00ad/index.htm
// soft hyphen (Entity Number: ­)
//regExp = /­/g;
//$str = $str.replace(regExp, "");
// http://www.fileformat.info/info/unicode/char/00ae/index.htm
// registered trademark (Entity Number: ®)
regExp = /®/g;
$str = $str.replace(regExp, "®");
// http://www.fileformat.info/info/unicode/char/00af/index.htm
// macron accent (Entity Number: ¯)
regExp = /¯/g;
$str = $str.replace(regExp, "¯");
// http://www.fileformat.info/info/unicode/char/00b0/index.htm
// degree sign (Entity Number: °)
regExp = /°/g;
$str = $str.replace(regExp, "°");
// http://www.fileformat.info/info/unicode/char/00b1/index.htm
// plus or minus (Entity Number: ±)
regExp = /±/g;
$str = $str.replace(regExp, "±");
// http://www.fileformat.info/info/unicode/char/00b2/index.htm
// superscript two (Entity Number: ²)
regExp = /²/g;
$str = $str.replace(regExp, "²");
// http://www.fileformat.info/info/unicode/char/00b3/index.htm
// superscript three (Entity Number: ³)
regExp = /³/g;
$str = $str.replace(regExp, "³");
// http://www.fileformat.info/info/unicode/char/00b4/index.htm
// acute accent (Entity Number: ´)
regExp = /´/g;
$str = $str.replace(regExp, "´");
// http://www.fileformat.info/info/unicode/char/00b5/index.htm
// micro sign (Entity Number: µ)
regExp = /µ/g;
$str = $str.replace(regExp, "µ");
// http://www.fileformat.info/info/unicode/char/00b6/index.htm
// paragraph sign (Entity Number: ¶)
regExp = /¶/g;
$str = $str.replace(regExp, "¶");
// http://www.fileformat.info/info/unicode/char/00b7/index.htm
// middle dot (Entity Number: ·)
regExp = /·/g;
$str = $str.replace(regExp, "·");
// http://www.fileformat.info/info/unicode/char/00b8/index.htm
// cedilla (Entity Number: ¸)
regExp = /¸/g;
$str = $str.replace(regExp, "¸");
// http://www.fileformat.info/info/unicode/char/00b9/index.htm
// superscript one (Entity Number: ¹)
regExp = /¹/g;
$str = $str.replace(regExp, "¹");
// http://www.fileformat.info/info/unicode/char/00ba/index.htm
// masculine ordinal (Entity Number: º)
regExp = /º/g;
$str = $str.replace(regExp, "º");
// http://www.fileformat.info/info/unicode/char/00bb/index.htm
// right angle quote (Entity Number: »)
regExp = /»/g;
$str = $str.replace(regExp, "»");
// http://www.fileformat.info/info/unicode/char/00bc/index.htm
// one-fourth (Entity Number: ¼)
regExp = /¼/g;
$str = $str.replace(regExp, "¼");
// http://www.fileformat.info/info/unicode/char/00bd/index.htm
// one-half (Entity Number: ½)
regExp = /½/g;
$str = $str.replace(regExp, "½");
// http://www.fileformat.info/info/unicode/char/00be/index.htm
// three-fourths (Entity Number: ¾)
regExp = /¾/g;
$str = $str.replace(regExp, "¾");
// http://www.fileformat.info/info/unicode/char/00bf/index.htm
// inverted question mark (Entity Number: ¿)
regExp = /¿/g;
$str = $str.replace(regExp, "¿");
// http://www.fileformat.info/info/unicode/char/00d7/index.htm
// multiplication sign (Entity Number: ×)
regExp = /×/g;
$str = $str.replace(regExp, "×");
// http://www.fileformat.info/info/unicode/char/00f7/index.htm
// division sign (Entity Number: ÷)
regExp = /÷/g;
$str = $str.replace(regExp, "÷");
///////////////////////////////////////////////////////////////////////
// ISO 8859-1 Characters
// http://www.w3schools.com/tags/ref_entities.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/00c0/index.htm
// uppercase A, grave accent (Entity Number: À)
regExp = /À/g;
$str = $str.replace(regExp, "À");
// http://www.fileformat.info/info/unicode/char/00c1/index.htm
// uppercase A, acute accent (Entity Number: Á)
regExp = /Á/g;
$str = $str.replace(regExp, "Á");
// http://www.fileformat.info/info/unicode/char/00c2/index.htm
// uppercase A, circumflex accent (Entity Number: Â)
regExp = /Â/g;
$str = $str.replace(regExp, "Â");
// http://www.fileformat.info/info/unicode/char/00c3/index.htm
// uppercase A, tilde (Entity Number: Ã)
regExp = /Ã/g;
$str = $str.replace(regExp, "Ã");
// http://www.fileformat.info/info/unicode/char/00c4/index.htm
// uppercase A, umlaut (Entity Number: Ä)
regExp = /Ä/g;
$str = $str.replace(regExp, "Ä");
// http://www.fileformat.info/info/unicode/char/00c5/index.htm
// uppercase A, ring (Entity Number: Å)
regExp = /Å/g;
$str = $str.replace(regExp, "Å");
// http://www.fileformat.info/info/unicode/char/00c6/index.htm
// uppercase AE (Entity Number: Æ)
regExp = /Æ/g;
$str = $str.replace(regExp, "Æ");
// http://www.fileformat.info/info/unicode/char/00c7/index.htm
// uppercase C, cedilla (Entity Number: Ç)
regExp = /Ç/g;
$str = $str.replace(regExp, "Ç");
// http://www.fileformat.info/info/unicode/char/00c8/index.htm
// uppercase E, grave accent (Entity Number: È)
regExp = /È/g;
$str = $str.replace(regExp, "È");
// http://www.fileformat.info/info/unicode/char/00c9/index.htm
// uppercase E, acute accent (Entity Number: É)
regExp = /É/g;
$str = $str.replace(regExp, "É");
// http://www.fileformat.info/info/unicode/char/00ca/index.htm
// uppercase E, circumflex accent (Entity Number: Ê)
regExp = /Ê/g;
$str = $str.replace(regExp, "Ê");
// http://www.fileformat.info/info/unicode/char/00cb/index.htm
// uppercase E, umlaut (Entity Number: Ë)
regExp = /Ë/g;
$str = $str.replace(regExp, "Ë");
// http://www.fileformat.info/info/unicode/char/00cc/index.htm
// uppercase I, grave accent (Entity Number: Ì)
regExp = /Ì/g;
$str = $str.replace(regExp, "Ì");
// http://www.fileformat.info/info/unicode/char/00cd/index.htm
// uppercase I, acute accent (Entity Number: Í)
regExp = /Í/g;
$str = $str.replace(regExp, "Í");
// http://www.fileformat.info/info/unicode/char/00ce/index.htm
// uppercase I, circumflex accent (Entity Number: Î)
regExp = /Î/g;
$str = $str.replace(regExp, "Î");
// http://www.fileformat.info/info/unicode/char/00cf/index.htm
// uppercase I, umlaut (Entity Number: Ï)
regExp = /Ï/g;
$str = $str.replace(regExp, "Ï");
// http://www.fileformat.info/info/unicode/char/00d0/index.htm
// uppercase Eth, Icelandic (Entity Number: Ð)
regExp = /Ð/g;
$str = $str.replace(regExp, "Ð");
// http://www.fileformat.info/info/unicode/char/00d1/index.htm
// uppercase N, tilde (Entity Number: Ñ)
regExp = /Ñ/g;
$str = $str.replace(regExp, "Ñ");
// http://www.fileformat.info/info/unicode/char/00d2/index.htm
// uppercase O, grave accent (Entity Number: Ò)
regExp = /Ò/g;
$str = $str.replace(regExp, "Ò");
// http://www.fileformat.info/info/unicode/char/00d3/index.htm
// uppercase O, acute accent (Entity Number: Ó)
regExp = /Ó/g;
$str = $str.replace(regExp, "Ó");
// http://www.fileformat.info/info/unicode/char/00d4/index.htm
// uppercase O, circumflex accent (Entity Number: Ô)
regExp = /Ô/g;
$str = $str.replace(regExp, "Ô");
// http://www.fileformat.info/info/unicode/char/00d5/index.htm
// uppercase O, tilde (Entity Number: Õ)
regExp = /Õ/g;
$str = $str.replace(regExp, "Õ");
// http://www.fileformat.info/info/unicode/char/00d6/index.htm
// uppercase O, umlaut (Entity Number: Ö)
regExp = /Ö/g;
$str = $str.replace(regExp, "Ö");
// http://www.fileformat.info/info/unicode/char/00d8/index.htm
// uppercase O, slash (Entity Number: Ø)
regExp = /Ø/g;
$str = $str.replace(regExp, "Ø");
// http://www.fileformat.info/info/unicode/char/00d9/index.htm
// uppercase U, grave accent (Entity Number: Ù)
regExp = /Ù/g;
$str = $str.replace(regExp, "Ù");
// http://www.fileformat.info/info/unicode/char/00da/index.htm
// uppercase U, acute accent (Entity Number: Ú)
regExp = /Ú/g;
$str = $str.replace(regExp, "Ú");
// http://www.fileformat.info/info/unicode/char/00db/index.htm
// uppercase U, circumflex accent (Entity Number: Û)
regExp = /Û/g;
$str = $str.replace(regExp, "Û");
// http://www.fileformat.info/info/unicode/char/00dc/index.htm
// uppercase U, umlaut (Entity Number: Ü)
regExp = /Ü/g;
$str = $str.replace(regExp, "Ü");
// http://www.fileformat.info/info/unicode/char/00dd/index.htm
// uppercase Y, acute accent (Entity Number: Ý)
regExp = /Ý/g;
$str = $str.replace(regExp, "Ý");
// http://www.fileformat.info/info/unicode/char/00de/index.htm
// uppercase THORN, Icelandic (Entity Number: Þ)
regExp = /Þ/g;
$str = $str.replace(regExp, "Þ");
// http://www.fileformat.info/info/unicode/char/00df/index.htm
// lowercase sharps, German (Entity Number: ß)
regExp = /ß/g;
$str = $str.replace(regExp, "ß");
// http://www.fileformat.info/info/unicode/char/00e0/index.htm
// lowercase a, grave accent (Entity Number: à)
regExp = /à/g;
$str = $str.replace(regExp, "à");
// http://www.fileformat.info/info/unicode/char/00e1/index.htm
// lowercase a, acute accent (Entity Number: á)
regExp = /á/g;
$str = $str.replace(regExp, "á");
// http://www.fileformat.info/info/unicode/char/00e2/index.htm
// lowercase a, circumflex accent (Entity Number: â)
regExp = /â/g;
$str = $str.replace(regExp, "â");
// http://www.fileformat.info/info/unicode/char/00e3/index.htm
// lowercase a, tilde (Entity Number: ã)
regExp = /ã/g;
$str = $str.replace(regExp, "ã");
// http://www.fileformat.info/info/unicode/char/00e4/index.htm
// lowercase a, umlaut (Entity Number: ä)
regExp = /ä/g;
$str = $str.replace(regExp, "ä");
// http://www.fileformat.info/info/unicode/char/00e5/index.htm
// lowercase a, ring (Entity Number: å)
regExp = /å/g;
$str = $str.replace(regExp, "å");
// http://www.fileformat.info/info/unicode/char/00e6/index.htm
// lowercase ae (Entity Number: æ)
regExp = /æ/g;
$str = $str.replace(regExp, "æ");
// http://www.fileformat.info/info/unicode/char/00e7/index.htm
// lowercase c, cedilla (Entity Number: ç)
regExp = /ç/g;
$str = $str.replace(regExp, "ç");
// http://www.fileformat.info/info/unicode/char/00e8/index.htm
// lowercase e, grave accent (Entity Number: è)
regExp = /è/g;
$str = $str.replace(regExp, "è");
// http://www.fileformat.info/info/unicode/char/00e9/index.htm
// lowercase e, acute accent (Entity Number: é)
regExp = /é/g;
$str = $str.replace(regExp, "é");
// http://www.fileformat.info/info/unicode/char/00ea/index.htm
// lowercase e, circumflex accent (Entity Number: ê)
regExp = /ê/g;
$str = $str.replace(regExp, "ê");
// http://www.fileformat.info/info/unicode/char/00eb/index.htm
// lowercase e, umlaut (Entity Number: ë)
regExp = /ë/g;
$str = $str.replace(regExp, "ë");
// http://www.fileformat.info/info/unicode/char/00ec/index.htm
// lowercase i, grave accent (Entity Number: ì)
regExp = /ì/g;
$str = $str.replace(regExp, "ì");
// http://www.fileformat.info/info/unicode/char/00ed/index.htm
// lowercase i, acute accent (Entity Number: í)
regExp = /í/g;
$str = $str.replace(regExp, "í");
// http://www.fileformat.info/info/unicode/char/00ee/index.htm
// lowercase i, circumflex accent (Entity Number: î)
regExp = /î/g;
$str = $str.replace(regExp, "î");
// http://www.fileformat.info/info/unicode/char/00ef/index.htm
// lowercase i, umlaut (Entity Number: ï)
regExp = /ï/g;
$str = $str.replace(regExp, "ï");
// http://www.fileformat.info/info/unicode/char/00f0/index.htm
// lowercase eth, Icelandic (Entity Number: ð)
regExp = /ð/g;
$str = $str.replace(regExp, "ð");
// http://www.fileformat.info/info/unicode/char/00f1/index.htm
// lowercase n, tilde (Entity Number: ñ)
regExp = /ñ/g;
$str = $str.replace(regExp, "ñ");
// http://www.fileformat.info/info/unicode/char/00f2/index.htm
// lowercase o, grave accent (Entity Number: ò)
regExp = /ò/g;
$str = $str.replace(regExp, "ò");
// http://www.fileformat.info/info/unicode/char/00f3/index.htm
// lowercase o, acute accent (Entity Number: ó)
regExp = /ó/g;
$str = $str.replace(regExp, "ó");
// http://www.fileformat.info/info/unicode/char/00f4/index.htm
// lowercase o, circumflex accent (Entity Number: ô)
regExp = /ô/g;
$str = $str.replace(regExp, "ô");
// http://www.fileformat.info/info/unicode/char/00f5/index.htm
// lowercase o, tilde (Entity Number: õ)
regExp = /õ/g;
$str = $str.replace(regExp, "õ");
// http://www.fileformat.info/info/unicode/char/00f6/index.htm
// lowercase o, umlaut (Entity Number: ö)
regExp = /ö/g;
$str = $str.replace(regExp, "ö");
// http://www.fileformat.info/info/unicode/char/00f8/index.htm
// lowercase o, slash (Entity Number: ø)
regExp = /ø/g;
$str = $str.replace(regExp, "ø");
// http://www.fileformat.info/info/unicode/char/00f9/index.htm
// lowercase u, grave accent (Entity Number: ù)
regExp = /ù/g;
$str = $str.replace(regExp, "ù");
// http://www.fileformat.info/info/unicode/char/00fa/index.htm
// lowercase u, acute accent (Entity Number: ú)
regExp = /ú/g;
$str = $str.replace(regExp, "ú");
// http://www.fileformat.info/info/unicode/char/00fb/index.htm
// lowercase u, circumflex accent (Entity Number: û)
regExp = /û/g;
$str = $str.replace(regExp, "û");
// http://www.fileformat.info/info/unicode/char/00fc/index.htm
// lowercase u, umlaut (Entity Number: ü)
regExp = /ü/g;
$str = $str.replace(regExp, "ü");
// http://www.fileformat.info/info/unicode/char/00fd/index.htm
// lowercase y, acute accent (Entity Number: ý)
regExp = /ý/g;
$str = $str.replace(regExp, "ý");
// http://www.fileformat.info/info/unicode/char/00fe/index.htm
// lowercase thorn, Icelandic (Entity Number: þ)
regExp = /þ/g;
$str = $str.replace(regExp, "þ");
// http://www.fileformat.info/info/unicode/char/00ff/index.htm
// lowercase y, umlaut (Entity Number: ÿ)
regExp = /ÿ/g;
$str = $str.replace(regExp, "ÿ");
///////////////////////////////////////////////////////////////////////
// Math Symbols Supported by HTML
// http://www.w3schools.com/tags/ref_symbols.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/2200/index.htm
// for all (Entity Number: ∀)
regExp = /∀/g;
$str = $str.replace(regExp, "∀");
// http://www.fileformat.info/info/unicode/char/2202/index.htm
// part (Entity Number: ∂)
regExp = /∂/g;
$str = $str.replace(regExp, "∂");
// http://www.fileformat.info/info/unicode/char/2203/index.htm
// exists (Entity Number: ∃)
regExp = /∃/g;
$str = $str.replace(regExp, "∃");
// http://www.fileformat.info/info/unicode/char/2205/index.htm
// empty (Entity Number: ∅)
regExp = /∅/g;
$str = $str.replace(regExp, "∅");
// http://www.fileformat.info/info/unicode/char/2207/index.htm
// nabla (Entity Number: ∇)
regExp = /∇/g;
$str = $str.replace(regExp, "∇");
// http://www.fileformat.info/info/unicode/char/2208/index.htm
// isin (Entity Number: ∈)
regExp = /∈/g;
$str = $str.replace(regExp, "∈");
// http://www.fileformat.info/info/unicode/char/2209/index.htm
// notin (Entity Number: ∉)
regExp = /∉/g;
$str = $str.replace(regExp, "∉");
// http://www.fileformat.info/info/unicode/char/220b/index.htm
// ni (Entity Number: ∋)
regExp = /∋/g;
$str = $str.replace(regExp, "∋");
// http://www.fileformat.info/info/unicode/char/220f/index.htm
// prod (Entity Number: ∏)
regExp = /∏/g;
$str = $str.replace(regExp, "∏");
// http://www.fileformat.info/info/unicode/char/2211/index.htm
// sum (Entity Number: ∑)
regExp = /∑/g;
$str = $str.replace(regExp, "∑");
// http://www.fileformat.info/info/unicode/char/2212/index.htm
// minus (Entity Number: −)
regExp = /−/g;
$str = $str.replace(regExp, "−");
// http://www.fileformat.info/info/unicode/char/2217/index.htm
// lowast (Entity Number: ∗)
regExp = /∗/g;
$str = $str.replace(regExp, "∗");
// http://www.fileformat.info/info/unicode/char/221a/index.htm
// square root (Entity Number: √)
regExp = /√/g;
$str = $str.replace(regExp, "√");
// http://www.fileformat.info/info/unicode/char/221d/index.htm
// proportional to (Entity Number: ∝)
regExp = /∝/g;
$str = $str.replace(regExp, "∝");
// http://www.fileformat.info/info/unicode/char/221e/index.htm
// infinity (Entity Number: ∞)
regExp = /∞/g;
$str = $str.replace(regExp, "∞");
// http://www.fileformat.info/info/unicode/char/2220/index.htm
// angle (Entity Number: ∠)
regExp = /∠/g;
$str = $str.replace(regExp, "∠");
// http://www.fileformat.info/info/unicode/char/2227/index.htm
// and (Entity Number: ∧)
regExp = /∧/g;
$str = $str.replace(regExp, "∧");
// http://www.fileformat.info/info/unicode/char/2228/index.htm
// or (Entity Number: ∨)
regExp = /∨/g;
$str = $str.replace(regExp, "∨");
// http://www.fileformat.info/info/unicode/char/2229/index.htm
// cap (Entity Number: ∩)
regExp = /∩/g;
$str = $str.replace(regExp, "∩");
// http://www.fileformat.info/info/unicode/char/222a/index.htm
// cup (Entity Number: ∪)
regExp = /∪/g;
$str = $str.replace(regExp, "∪");
// http://www.fileformat.info/info/unicode/char/222b/index.htm
// integral (Entity Number: ∫)
regExp = /∫/g;
$str = $str.replace(regExp, "∫");
// http://www.fileformat.info/info/unicode/char/2234/index.htm
// therefore (Entity Number: ∴)
regExp = /∴/g;
$str = $str.replace(regExp, "∴");
// http://www.fileformat.info/info/unicode/char/223c/index.htm
// similar to (Entity Number: ∼)
regExp = /∼/g;
$str = $str.replace(regExp, "∼");
// http://www.fileformat.info/info/unicode/char/2245/index.htm
// congruent to (Entity Number: ≅)
regExp = /≅/g;
$str = $str.replace(regExp, "≅");
// http://www.fileformat.info/info/unicode/char/2248/index.htm
// almost equal (Entity Number: ≈)
regExp = /≈/g;
$str = $str.replace(regExp, "≈");
// http://www.fileformat.info/info/unicode/char/2260/index.htm
// not equal (Entity Number: ≠)
regExp = /≠/g;
$str = $str.replace(regExp, "≠");
// http://www.fileformat.info/info/unicode/char/2261/index.htm
// equivalent (Entity Number: ≡)
regExp = /≡/g;
$str = $str.replace(regExp, "≡");
// http://www.fileformat.info/info/unicode/char/2264/index.htm
// less or equal (Entity Number: ≤)
regExp = /≤/g;
$str = $str.replace(regExp, "≤");
// http://www.fileformat.info/info/unicode/char/2265/index.htm
// greater or equal (Entity Number: ≥)
regExp = /≥/g;
$str = $str.replace(regExp, "≥");
// http://www.fileformat.info/info/unicode/char/2282/index.htm
// subset of (Entity Number: ⊂)
regExp = /⊂/g;
$str = $str.replace(regExp, "⊂");
// http://www.fileformat.info/info/unicode/char/2283/index.htm
// superset of (Entity Number: ⊃)
regExp = /⊃/g;
$str = $str.replace(regExp, "⊃");
// http://www.fileformat.info/info/unicode/char/2284/index.htm
// not subset of (Entity Number: ⊄)
regExp = /⊄/g;
$str = $str.replace(regExp, "⊄");
// http://www.fileformat.info/info/unicode/char/2286/index.htm
// subset or equal (Entity Number: ⊆)
regExp = /⊆/g;
$str = $str.replace(regExp, "⊆");
// http://www.fileformat.info/info/unicode/char/2287/index.htm
// superset or equal (Entity Number: ⊇)
regExp = /⊇/g;
$str = $str.replace(regExp, "⊇");
// http://www.fileformat.info/info/unicode/char/2295/index.htm
// circled plus (Entity Number: ⊕)
regExp = /⊕/g;
$str = $str.replace(regExp, "⊕");
// http://www.fileformat.info/info/unicode/char/2297/index.htm
// cirled times (Entity Number: ⊗)
regExp = /⊗/g;
$str = $str.replace(regExp, "⊗");
// http://www.fileformat.info/info/unicode/char/22a5/index.htm
// perpendicular (Entity Number: ⊥)
regExp = /⊥/g;
$str = $str.replace(regExp, "⊥");
// http://www.fileformat.info/info/unicode/char/22c5/index.htm
// dot operator (Entity Number: ⋅)
regExp = /⋅/g;
$str = $str.replace(regExp, "⋅");
///////////////////////////////////////////////////////////////////////
// Greek Letters Supported by HTML
// http://www.w3schools.com/tags/ref_symbols.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/0391/index.htm
// Alpha (Entity Number: Α)
regExp = /Α/g;
$str = $str.replace(regExp, "Α");
// http://www.fileformat.info/info/unicode/char/0392/index.htm
// Beta (Entity Number: Β)
regExp = /Β/g;
$str = $str.replace(regExp, "Β");
// http://www.fileformat.info/info/unicode/char/0393/index.htm
// Gamma (Entity Number: Γ)
regExp = /Γ/g;
$str = $str.replace(regExp, "Γ");
// http://www.fileformat.info/info/unicode/char/0394/index.htm
// Delta (Entity Number: Δ)
regExp = /Δ/g;
$str = $str.replace(regExp, "Δ");
// http://www.fileformat.info/info/unicode/char/0395/index.htm
// Epsilon (Entity Number: Ε)
regExp = /Ε/g;
$str = $str.replace(regExp, "Ε");
// http://www.fileformat.info/info/unicode/char/0396/index.htm
// Zeta (Entity Number: Ζ)
regExp = /Ζ/g;
$str = $str.replace(regExp, "Ζ");
// http://www.fileformat.info/info/unicode/char/0397/index.htm
// Eta (Entity Number: Η)
regExp = /Η/g;
$str = $str.replace(regExp, "Η");
// http://www.fileformat.info/info/unicode/char/0398/index.htm
// Theta (Entity Number: Θ)
regExp = /Θ/g;
$str = $str.replace(regExp, "Θ");
// http://www.fileformat.info/info/unicode/char/0399/index.htm
// Iota (Entity Number: Ι)
regExp = /Ι/g;
$str = $str.replace(regExp, "Ι");
// http://www.fileformat.info/info/unicode/char/039a/index.htm
// Kappa (Entity Number: Κ)
regExp = /Κ/g;
$str = $str.replace(regExp, "Κ");
// http://www.fileformat.info/info/unicode/char/039b/index.htm
// Lambda (Entity Number: Λ)
regExp = /Λ/g;
$str = $str.replace(regExp, "Λ");
// http://www.fileformat.info/info/unicode/char/039c/index.htm
// Mu (Entity Number: Μ)
regExp = /Μ/g;
$str = $str.replace(regExp, "Μ");
// http://www.fileformat.info/info/unicode/char/039d/index.htm
// Nu (Entity Number: Ν)
regExp = /Ν/g;
$str = $str.replace(regExp, "Ν");
// http://www.fileformat.info/info/unicode/char/039e/index.htm
// Xi (Entity Number: Ξ)
regExp = /Ξ/g;
$str = $str.replace(regExp, "Ξ");
// http://www.fileformat.info/info/unicode/char/039f/index.htm
// Omicron (Entity Number: Ο)
regExp = /Ο/g;
$str = $str.replace(regExp, "Ο");
// http://www.fileformat.info/info/unicode/char/03a0/index.htm
// Pi (Entity Number: Π)
regExp = /Π/g;
$str = $str.replace(regExp, "Π");
// http://www.fileformat.info/info/unicode/char/03a1/index.htm
// Rho (Entity Number: Ρ)
regExp = /Ρ/g;
$str = $str.replace(regExp, "Ρ");
// http://www.fileformat.info/info/unicode/char/03a3/index.htm
// Sigma (Entity Number: Σ)
regExp = /Σ/g;
$str = $str.replace(regExp, "Σ");
// http://www.fileformat.info/info/unicode/char/03a4/index.htm
// Tau (Entity Number: Τ)
regExp = /Τ/g;
$str = $str.replace(regExp, "Τ");
// http://www.fileformat.info/info/unicode/char/03a5/index.htm
// Upsilon (Entity Number: Υ)
regExp = /Υ/g;
$str = $str.replace(regExp, "Υ");
// http://www.fileformat.info/info/unicode/char/03a6/index.htm
// Phi (Entity Number: Φ)
regExp = /Φ/g;
$str = $str.replace(regExp, "Φ");
// http://www.fileformat.info/info/unicode/char/03a7/index.htm
// Chi (Entity Number: Χ)
regExp = /Χ/g;
$str = $str.replace(regExp, "Χ");
// http://www.fileformat.info/info/unicode/char/03a8/index.htm
// Psi (Entity Number: Ψ)
regExp = /Ψ/g;
$str = $str.replace(regExp, "Ψ");
// http://www.fileformat.info/info/unicode/char/03a9/index.htm
// Omega (Entity Number: Ω)
regExp = /Ω/g;
$str = $str.replace(regExp, "Ω");
// http://www.fileformat.info/info/unicode/char/03b1/index.htm
// alpha (Entity Number: α)
regExp = /α/g;
$str = $str.replace(regExp, "α");
// http://www.fileformat.info/info/unicode/char/03b2/index.htm
// beta (Entity Number: β)
regExp = /β/g;
$str = $str.replace(regExp, "β");
// http://www.fileformat.info/info/unicode/char/03b3/index.htm
// gamma (Entity Number: γ)
regExp = /γ/g;
$str = $str.replace(regExp, "γ");
// http://www.fileformat.info/info/unicode/char/03b4/index.htm
// delta (Entity Number: δ)
regExp = /δ/g;
$str = $str.replace(regExp, "δ");
// http://www.fileformat.info/info/unicode/char/03b5/index.htm
// epsilon (Entity Number: ε)
regExp = /ε/g;
$str = $str.replace(regExp, "ε");
// http://www.fileformat.info/info/unicode/char/03b6/index.htm
// zeta (Entity Number: ζ)
regExp = /ζ/g;
$str = $str.replace(regExp, "ζ");
// http://www.fileformat.info/info/unicode/char/03b7/index.htm
// eta (Entity Number: η)
regExp = /η/g;
$str = $str.replace(regExp, "η");
// http://www.fileformat.info/info/unicode/char/03b8/index.htm
// theta (Entity Number: θ)
regExp = /θ/g;
$str = $str.replace(regExp, "θ");
// http://www.fileformat.info/info/unicode/char/03b9/index.htm
// iota (Entity Number: ι)
regExp = /ι/g;
$str = $str.replace(regExp, "ι");
// http://www.fileformat.info/info/unicode/char/03ba/index.htm
// kappa (Entity Number: κ)
regExp = /κ/g;
$str = $str.replace(regExp, "κ");
// http://www.fileformat.info/info/unicode/char/03bb/index.htm
// lambda (Entity Number: λ)
regExp = /λ/g;
$str = $str.replace(regExp, "λ");
// http://www.fileformat.info/info/unicode/char/03bc/index.htm
// mu (Entity Number: μ)
regExp = /μ/g;
$str = $str.replace(regExp, "μ");
// http://www.fileformat.info/info/unicode/char/03bd/index.htm
// nu (Entity Number: ν)
regExp = /ν/g;
$str = $str.replace(regExp, "ν");
// http://www.fileformat.info/info/unicode/char/03be/index.htm
// xi (Entity Number: ξ)
regExp = /ξ/g;
$str = $str.replace(regExp, "ξ");
// http://www.fileformat.info/info/unicode/char/03bf/index.htm
// omicron (Entity Number: ο)
regExp = /ο/g;
$str = $str.replace(regExp, "ο");
// http://www.fileformat.info/info/unicode/char/03c0/index.htm
// pi (Entity Number: π)
regExp = /π/g;
$str = $str.replace(regExp, "π");
// http://www.fileformat.info/info/unicode/char/03c1/index.htm
// rho (Entity Number: ρ)
regExp = /ρ/g;
$str = $str.replace(regExp, "ρ");
// http://www.fileformat.info/info/unicode/char/03c2/index.htm
// sigmaf (Entity Number: ς)
regExp = /ς/g;
$str = $str.replace(regExp, "ς");
// http://www.fileformat.info/info/unicode/char/03c3/index.htm
// sigma (Entity Number: σ)
regExp = /σ/g;
$str = $str.replace(regExp, "σ");
// http://www.fileformat.info/info/unicode/char/03c4/index.htm
// tau (Entity Number: τ)
regExp = /τ/g;
$str = $str.replace(regExp, "τ");
// http://www.fileformat.info/info/unicode/char/03c5/index.htm
// upsilon (Entity Number: υ)
regExp = /υ/g;
$str = $str.replace(regExp, "υ");
// http://www.fileformat.info/info/unicode/char/03c6/index.htm
// phi (Entity Number: φ)
regExp = /φ/g;
$str = $str.replace(regExp, "φ");
// http://www.fileformat.info/info/unicode/char/03c7/index.htm
// chi (Entity Number: χ)
regExp = /χ/g;
$str = $str.replace(regExp, "χ");
// http://www.fileformat.info/info/unicode/char/03c8/index.htm
// psi (Entity Number: ψ)
regExp = /ψ/g;
$str = $str.replace(regExp, "ψ");
// http://www.fileformat.info/info/unicode/char/03c9/index.htm
// omega (Entity Number: ω)
regExp = /ω/g;
$str = $str.replace(regExp, "ω");
// http://www.fileformat.info/info/unicode/char/03d1/index.htm
// theta symbol (Entity Number: ϑ)
regExp = /ϑ/g;
$str = $str.replace(regExp, "ϑ");
// http://www.fileformat.info/info/unicode/char/03d2/index.htm
// upsilon symbol (Entity Number: ϒ)
regExp = /ϒ/g;
$str = $str.replace(regExp, "ϒ");
// http://www.fileformat.info/info/unicode/char/03d6/index.htm
// pi symbol (Entity Number: ϖ)
regExp = /ϖ/g;
$str = $str.replace(regExp, "ϖ");
///////////////////////////////////////////////////////////////////////
// Other Entities Supported by HTML
// http://www.w3schools.com/tags/ref_symbols.asp
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/0152/index.htm
// capital ligature OE (Entity Number: Œ)
regExp = /Œ/g;
$str = $str.replace(regExp, "Œ");
// http://www.fileformat.info/info/unicode/char/0153/index.htm
// small ligature oe (Entity Number: œ)
regExp = /œ/g;
$str = $str.replace(regExp, "œ");
// http://www.fileformat.info/info/unicode/char/0160/index.htm
// capital S with caron (Entity Number: Š)
regExp = /Š/g;
$str = $str.replace(regExp, "Š");
// http://www.fileformat.info/info/unicode/char/0161/index.htm
// small S with caron (Entity Number: š)
regExp = /š/g;
$str = $str.replace(regExp, "š");
// http://www.fileformat.info/info/unicode/char/0178/index.htm
// capital Y with diaeres (Entity Number: Ÿ)
regExp = /Ÿ/g;
$str = $str.replace(regExp, "Ÿ");
// http://www.fileformat.info/info/unicode/char/0192/index.htm
// f with hook (Entity Number: ƒ)
regExp = /ƒ/g;
$str = $str.replace(regExp, "ƒ");
// http://www.fileformat.info/info/unicode/char/02c6/index.htm
// modifier letter circumflex accent (Entity Number: ˆ)
regExp = /ˆ/g;
$str = $str.replace(regExp, "ˆ");
// http://www.fileformat.info/info/unicode/char/02dc/index.htm
// small tilde (Entity Number: ˜)
regExp = /˜/g;
$str = $str.replace(regExp, "˜");
// http://www.fileformat.info/info/unicode/char/2002/index.htm
// en space (Entity Number:  )
regExp = / /g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/2003/index.htm
// em space (Entity Number:  )
regExp = / /g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/2009/index.htm
// thin space (Entity Number:  )
regExp = / /g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/200c/index.htm
// zero width non-joiner (Entity Number: ‌)
//regExp = /‌/g;
//$str = $str.replace(regExp, "");
// http://www.fileformat.info/info/unicode/char/200d/index.htm
// zero width joiner (Entity Number: ‍)
//regExp = /‍/g;
//$str = $str.replace(regExp, "");
// http://www.fileformat.info/info/unicode/char/200e/index.htm
// left-to-right mark (Entity Number: ‎)
regExp = /‎/g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/200f/index.htm
// right-to-left mark (Entity Number: ‏)
regExp = /‏/g;
$str = $str.replace(regExp, " ");
// http://www.fileformat.info/info/unicode/char/2013/index.htm
// en dash (Entity Number: –)
regExp = /–/g;
$str = $str.replace(regExp, "–");
// http://www.fileformat.info/info/unicode/char/2014/index.htm
// em dash (Entity Number: —)
regExp = /—/g;
$str = $str.replace(regExp, "—");
// http://www.fileformat.info/info/unicode/char/2018/index.htm
// left single quote (Entity Number: ‘)
regExp = /‘/g;
$str = $str.replace(regExp, "‘");
// http://www.fileformat.info/info/unicode/char/2019/index.htm
// right single quote (Entity Number: ’)
regExp = /’/g;
$str = $str.replace(regExp, "’");
// http://www.fileformat.info/info/unicode/char/201a/index.htm
// single low-9 quote (Entity Number: ‚)
regExp = /‚/g;
$str = $str.replace(regExp, "‚");
// http://www.fileformat.info/info/unicode/char/201c/index.htm
// left double quote (Entity Number: “)
regExp = /“/g;
$str = $str.replace(regExp, "“");
// http://www.fileformat.info/info/unicode/char/201d/index.htm
// right double quote (Entity Number: ”)
regExp = /”/g;
$str = $str.replace(regExp, "”");
// http://www.fileformat.info/info/unicode/char/201e/index.htm
// double low-9 quote (Entity Number: „)
regExp = /„/g;
$str = $str.replace(regExp, "„");
// http://www.fileformat.info/info/unicode/char/2020/index.htm
// dagger (Entity Number: †)
regExp = /†/g;
$str = $str.replace(regExp, "†");
// http://www.fileformat.info/info/unicode/char/2021/index.htm
// double dagger (Entity Number: ‡)
regExp = /‡/g;
$str = $str.replace(regExp, "‡");
// http://www.fileformat.info/info/unicode/char/2022/index.htm
// bullet (Entity Number: •)
regExp = /•/g;
$str = $str.replace(regExp, "•");
// http://www.fileformat.info/info/unicode/char/2026/index.htm
// horizontal ellipsis (Entity Number: …)
regExp = /…/g;
$str = $str.replace(regExp, "…");
// http://www.fileformat.info/info/unicode/char/2030/index.htm
// per mill sign (Entity Number: ‰)
regExp = /‰/g;
$str = $str.replace(regExp, "‰");
// http://www.fileformat.info/info/unicode/char/2032/index.htm
// minutes (Entity Number: ′)
regExp = /′/g;
$str = $str.replace(regExp, "′");
// http://www.fileformat.info/info/unicode/char/2033/index.htm
// seconds (Entity Number: ″)
regExp = /″/g;
$str = $str.replace(regExp, "″");
// http://www.fileformat.info/info/unicode/char/2039/index.htm
// single left-pointing angle quote (Entity Number: ‹)
regExp = /‹/g;
$str = $str.replace(regExp, "‹");
// http://www.fileformat.info/info/unicode/char/203a/index.htm
// single right-pointing angle quote (Entity Number: ›)
regExp = /›/g;
$str = $str.replace(regExp, "›");
// http://www.fileformat.info/info/unicode/char/203e/index.htm
// overline, = spacing overscore (Entity Number: ‾)
regExp = /‾/g;
$str = $str.replace(regExp, "‾");
// http://www.fileformat.info/info/unicode/char/20ac/index.htm
// euro (Entity Number: €)
regExp = /€/g;
$str = $str.replace(regExp, "€");
// http://www.fileformat.info/info/unicode/char/2122/index.htm
// trademark sign (Entity Number: ™)
regExp = /™/g;
$str = $str.replace(regExp, "™");
// http://www.fileformat.info/info/unicode/char/2190/index.htm
// leftward arrow (Entity Number: ←)
regExp = /←/g;
$str = $str.replace(regExp, "←");
// http://www.fileformat.info/info/unicode/char/2191/index.htm
// upward arrow (Entity Number: ↑)
regExp = /↑/g;
$str = $str.replace(regExp, "↑");
// http://www.fileformat.info/info/unicode/char/2192/index.htm
// rightward arrow (Entity Number: →)
regExp = /→/g;
$str = $str.replace(regExp, "→");
// http://www.fileformat.info/info/unicode/char/2193/index.htm
// downward arrow (Entity Number: ↓)
regExp = /↓/g;
$str = $str.replace(regExp, "↓");
// http://www.fileformat.info/info/unicode/char/2194/index.htm
// left right arrow (Entity Number: ↔)
regExp = /↔/g;
$str = $str.replace(regExp, "↔");
// http://www.fileformat.info/info/unicode/char/21b5/index.htm
// carriage return arrow (Entity Number: ↵)
regExp = /↵/g;
$str = $str.replace(regExp, "↵");
// http://www.fileformat.info/info/unicode/char/2308/index.htm
// left ceiling (Entity Number: ⌈)
regExp = /⌈/g;
$str = $str.replace(regExp, "⌈");
// http://www.fileformat.info/info/unicode/char/2309/index.htm
// right ceiling (Entity Number: ⌉)
regExp = /⌉/g;
$str = $str.replace(regExp, "⌉");
// http://www.fileformat.info/info/unicode/char/230a/index.htm
// left floor (Entity Number: ⌊)
regExp = /⌊/g;
$str = $str.replace(regExp, "⌊");
// http://www.fileformat.info/info/unicode/char/230b/index.htm
// right floor (Entity Number: ⌋)
regExp = /⌋/g;
$str = $str.replace(regExp, "⌋");
// http://www.fileformat.info/info/unicode/char/25ca/index.htm
// lozenge (Entity Number: ◊)
regExp = /◊/g;
$str = $str.replace(regExp, "◊");
// http://www.fileformat.info/info/unicode/char/2660/index.htm
// black spade suit (Entity Number: ♠)
regExp = /♠/g;
$str = $str.replace(regExp, "♠");
// http://www.fileformat.info/info/unicode/char/2663/index.htm
// black club suit (Entity Number: ♣)
regExp = /♣/g;
$str = $str.replace(regExp, "♣");
// http://www.fileformat.info/info/unicode/char/2665/index.htm
// black heart suit (Entity Number: ♥)
regExp = /♥/g;
$str = $str.replace(regExp, "♥");
// http://www.fileformat.info/info/unicode/char/2666/index.htm
// black diamond suit (Entity Number: ♦)
regExp = /♦/g;
$str = $str.replace(regExp, "♦");
///////////////////////////////////////////////////////////////////////
// Other Named Entities
///////////////////////////////////////////////////////////////////////
// http://www.fileformat.info/info/unicode/char/002f/index.htm
// slash (Entity Number: /)
regExp = /⁄/g;
$str = $str.replace(regExp, "/");
///////////////////////////////////////////////////////////////////////
return $str;
}
}
}
// Usage Example
//
// import com.adrianparr.utils.HtmlEntityNames;
// var myString1:String = "©";
// trace(HtmlEntityNames.encode(myString1));
// var myString2:String = "♣";
// trace(HtmlEntityNames.decode(myString2));
//
// OUTPUT
// ©
// ♣