Advertisement
englishextra

entities.class.php

Sep 5th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 50.01 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * $shimansky.biz
  5.  *
  6.  * Static web site core scripts
  7.  * @category PHP
  8.  * @access public
  9.  * @copyright (c) 2012 Shimansky.biz
  10.  * @author Serguei Shimansky <serguei@shimansky.biz>
  11.  * @license http://opensource.org/licenses/bsd-license.php
  12.  * @package shimansky.biz
  13.  * @link https://bitbucket.org/englishextra/shimansky.biz
  14.  * @link https://github.com/englishextra/shimansky.biz.git
  15.  */
  16.  
  17. /**
  18.  * General purpose PHP class to work with strings and files
  19.  *
  20.  * PHP version 5.4+
  21.  *
  22.  * Copyright (c) 2012 Shimansky.biz
  23.  * All rights reserved.
  24.  *
  25.  * Redistribution and use in source and binary forms, with or without
  26.  * modification, are permitted provided that the following conditions are met:
  27.  * 1. Redistributions of source code must retain the above copyright
  28.  *    notice, this list of conditions and the following disclaimer.
  29.  * 2. Redistributions in binary form must reproduce the above copyright
  30.  *    notice, this list of conditions and the following disclaimer in the
  31.  *    documentation and/or other materials provided with the distribution.
  32.  * 3. All advertising materials mentioning features or use of this software
  33.  *    must display the following acknowledgement:
  34.  *    This product includes software developed by the organization.
  35.  * 4. Neither the name of the organizatio> nor the
  36.  *    names of its contributors may be used to endorse or promote products
  37.  *    derived from this software without specific prior written permission.
  38.  *
  39.  * THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ''AS IS'' AND ANY
  40.  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  41.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  42.  * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY
  43.  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  44.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  45.  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  46.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  47.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  48.  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  49.  *
  50.  * Methods:
  51.  *
  52.  * 1. text_digits_to_dec_ents
  53.  * 2. text_symbs_to_num_ents
  54.  * 3. named_symbs_to_num_ents
  55.  * 4. latin_text_chars_to_num_ents
  56.  * 5. acc_text_to_num_ents
  57.  * 6. acc_named_to_num_ents
  58.  * 7. cyr_text_chars_to_num_ents
  59.  * 8. cyr_named_chars_to_num_ents
  60.  *
  61.  * PHP version 5.4+
  62.  *
  63.  * @category PHP
  64.  * @access public
  65.  * @copyright (c) 2012 Shimansky.biz
  66.  * @author Serguei Shimansky <serguei@shimansky.biz>
  67.  * @license http://opensource.org/licenses/bsd-license.php
  68.  * @package shimansky.biz
  69.  * @version 0.1
  70.  * @https://github.com/englishextra/shimansky.biz
  71.  */
  72. class Entities {
  73.  
  74.     /**
  75.      *  There is a difference between the two: If you write an empty __construct() function, you overwrite any inherited __construct() from a parent class.
  76.      *  So if you don't need it and you do not want to overwrite the parent constructor explicitly, don't write it at all.
  77.      */
  78.     function __construct() {
  79.  
  80.     }
  81.  
  82.     /* this replacement should be done
  83.     before any other conversion to numeric entities */
  84.     public function text_digits_to_dec_ents($s) {
  85.  
  86.         /*
  87.         $a[] = null;
  88.  
  89.         $a[] = array(' ', '&#160;');
  90.  
  91.         $a[] = array('&', '&#38;');
  92.         $a[] = array('#', '&#35;');
  93.         $a[] = array(';', '&#59;');
  94.  
  95.         $a[] = array('0', '&#48;');
  96.         $a[] = array('1', '&#49;');
  97.         $a[] = array('2', '&#50;');
  98.         $a[] = array('3', '&#51;');
  99.         $a[] = array('4', '&#52;');
  100.         $a[] = array('5', '&#53;');
  101.         $a[] = array('6', '&#54;');
  102.         $a[] = array('7', '&#55;');
  103.         $a[] = array('8', '&#56;');
  104.         $a[] = array('9', '&#57;');
  105.  
  106.         $a = array(
  107.                     '0'=> '&#48;',
  108.                     '1'=> '&#49;',
  109.                     '2'=> '&#50;',
  110.                     '3'=> '&#51;',
  111.                     '4'=> '&#52;',
  112.                     '5'=> '&#53;',
  113.                     '6'=> '&#54;',
  114.                     '7'=> '&#55;',
  115.                     '8'=> '&#56;',
  116.                     '9'=> '&#57;'
  117.                     );
  118.         */
  119.  
  120.         $p = '';
  121.  
  122.         for ($x = 0; $x < strlen($s); $x++) {
  123.  
  124.             if (ctype_digit($s[$x])) {
  125.  
  126.                 $p .= '&#' . ord($s[$x]) . ';';
  127.  
  128.             } else {
  129.  
  130.                 $p .= $s[$x];
  131.             }
  132.         }
  133.  
  134.         return $p;
  135.     }
  136.  
  137.     public function text_symbs_to_dec_ents($s) {
  138.  
  139.         /*
  140.         $a[] = null;
  141.  
  142.         dont include these:
  143.  
  144.         $a[] = array(' ', '&#160;');
  145.  
  146.         $a[] = array('&', '&#38;');
  147.         $a[] = array('#', '&#35;');
  148.         $a[] = array(';', '&#59;');
  149.  
  150.         $a[] = array('0', '&#48;');
  151.         $a[] = array('1', '&#49;');
  152.         $a[] = array('2', '&#50;');
  153.         $a[] = array('3', '&#51;');
  154.         $a[] = array('4', '&#52;');
  155.         $a[] = array('5', '&#53;');
  156.         $a[] = array('6', '&#54;');
  157.         $a[] = array('7', '&#55;');
  158.         $a[] = array('8', '&#56;');
  159.         $a[] = array('9', '&#57;');
  160.         */
  161.  
  162.         $a = null;
  163.  
  164.         $a = array(
  165.  
  166.         '¡' => '&#161;', '¢' => '&#162;', '£' => '&#163;', '¤' => '&#164;', '¥' => '&#165;', '¦' => '&#166;', '§' => '&#167;', '¨' => '&#168;', '©' => '&#169;', 'ª' => '&#170;', '«' => '&#171;', '¬' => '&#172;', '­' => '&#173;', '®' => '&#174;', '¯' => '&#175;', '°' => '&#176;', '±' => '&#177;', '²' => '&#178;', '³' => '&#179;', '´' => '&#180;', 'µ' => '&#181;', '¶' => '&#182;', '·' => '&#183;', '¸' => '&#184;', '¹' => '&#185;', 'º' => '&#186;', '»' => '&#187;', '¼' => '&#188;', '½' => '&#189;', '¾' => '&#190;', '¿' => '&#191;', 'À' => '&#192;', 'Á' => '&#193;', 'Â' => '&#194;', 'Ã' => '&#195;', 'Ä' => '&#196;', 'Å' => '&#197;', 'Æ' => '&#198;', 'Ç' => '&#199;', 'È' => '&#200;', 'É' => '&#201;', 'Ê' => '&#202;', 'Ë' => '&#203;', 'Ì' => '&#204;', 'Í' => '&#205;', 'Î' => '&#206;', 'Ï' => '&#207;', 'Ð' => '&#208;', 'Ñ' => '&#209;', 'Ò' => '&#210;', 'Ó' => '&#211;', 'Ô' => '&#212;', 'Õ' => '&#213;', 'Ö' => '&#214;', '×' => '&#215;', 'Ø' => '&#216;', 'Ù' => '&#217;', 'Ú' => '&#218;', 'Û' => '&#219;', 'Ü' => '&#220;', 'Ý' => '&#221;', 'Þ' => '&#222;', 'ß' => '&#223;', 'à' => '&#224;', 'á' => '&#225;', 'â' => '&#226;', 'ã' => '&#227;', 'ä' => '&#228;', 'å' => '&#229;', 'æ' => '&#230;', 'ç' => '&#231;', 'è' => '&#232;', 'é' => '&#233;', 'ê' => '&#234;', 'ë' => '&#235;', 'ì' => '&#236;', 'í' => '&#237;', 'î' => '&#238;', 'ï' => '&#239;', 'ð' => '&#240;', 'ñ' => '&#241;', 'ò' => '&#242;', 'ó' => '&#243;', 'ô' => '&#244;', 'õ' => '&#245;', 'ö' => '&#246;', '÷' => '&#247;', 'ø' => '&#248;', 'ù' => '&#249;', 'ú' => '&#250;', 'û' => '&#251;', 'ü' => '&#252;', 'ý' => '&#253;', 'þ' => '&#254;', 'ÿ' => '&#255;', 'Œ' => '&#338;', 'œ' => '&#339;', 'Š' => '&#352;', 'š' => '&#353;', 'Ÿ' => '&#376;', 'ƒ' => '&#402;', 'ˆ' => '&#710;', '˜' => '&#732;', 'Α' => '&#913;', 'Β' => '&#914;', 'Γ' => '&#915;', 'Δ' => '&#916;', 'Ε' => '&#917;', 'Ζ' => '&#918;', 'Η' => '&#919;', 'Θ' => '&#920;', 'Ι' => '&#921;', 'Κ' => '&#922;', 'Λ' => '&#923;', 'Μ' => '&#924;', 'Ν' => '&#925;', 'Ξ' => '&#926;', 'Ο' => '&#927;', 'Π' => '&#928;', 'Ρ' => '&#929;', 'Σ' => '&#931;', 'Τ' => '&#932;', 'Υ' => '&#933;', 'Φ' => '&#934;', 'Χ' => '&#935;', 'Ψ' => '&#936;', 'Ω' => '&#937;', 'α' => '&#945;', 'β' => '&#946;', 'γ' => '&#947;', 'δ' => '&#948;', 'ε' => '&#949;', 'ζ' => '&#950;', 'η' => '&#951;', 'θ' => '&#952;', 'ι' => '&#953;', 'κ' => '&#954;', 'λ' => '&#955;', 'μ' => '&#956;', 'ν' => '&#957;', 'ξ' => '&#958;', 'ο' => '&#959;', 'π' => '&#960;', 'ρ' => '&#961;', 'ς' => '&#962;', 'σ' => '&#963;', 'τ' => '&#964;', 'υ' => '&#965;', 'φ' => '&#966;', 'χ' => '&#967;', 'ψ' => '&#968;', 'ω' => '&#969;', 'ϑ' => '&#977;', 'ϒ' => '&#978;', 'ϖ' => '&#982;', ' ' => '&#8194;', ' ' => '&#8195;', ' ' => '&#8201;', '‌' => '&#8204;', '‍' => '&#8205;', '‎' => '&#8206;', '‏' => '&#8207;', '–' => '&#8211;', '—' => '&#8212;', '‘' => '&#8216;', '’' => '&#8217;', '‚' => '&#8218;', '“' => '&#8220;', '”' => '&#8221;', '„' => '&#8222;', '†' => '&#8224;', '‡' => '&#8225;', '•' => '&#8226;', '…' => '&#8230;', '‰' => '&#8240;', '′' => '&#8242;', '″' => '&#8243;', '‹' => '&#8249;', '›' => '&#8250;', '‾' => '&#8254;', '⁄' => '&#8260;', '€' => '&#8364;', 'ℑ' => '&#8465;', '℘' => '&#8472;', 'ℜ' => '&#8476;', '™' => '&#8482;', 'ℵ' => '&#8501;', '←' => '&#8592;', '↑' => '&#8593;', '→' => '&#8594;', '↓' => '&#8595;', '↔' => '&#8596;', '↵' => '&#8629;', '⇐' => '&#8656;', '⇑' => '&#8657;', '⇒' => '&#8658;', '⇓' => '&#8659;', '⇔' => '&#8660;', '∀' => '&#8704;', '∂' => '&#8706;', '∃' => '&#8707;', '∅' => '&#8709;', '∇' => '&#8711;', '∈' => '&#8712;', '∉' => '&#8713;', '∋' => '&#8715;', '∏' => '&#8719;', '∑' => '&#8721;', '−' => '&#8722;', '∗' => '&#8727;', '√' => '&#8730;', '∝' => '&#8733;', '∞' => '&#8734;', '∠' => '&#8736;', '∧' => '&#8743;', '∨' => '&#8744;', '∩' => '&#8745;', '∪' => '&#8746;', '∫' => '&#8747;', '∴' => '&#8756;', '∼' => '&#8764;', '≅' => '&#8773;', '≈' => '&#8776;', '≠' => '&#8800;', '≡' => '&#8801;', '≤' => '&#8804;', '≥' => '&#8805;', '⊂' => '&#8834;', '⊃' => '&#8835;', '⊄' => '&#8836;', '⊆' => '&#8838;', '⊇' => '&#8839;', '⊕' => '&#8853;', '⊗' => '&#8855;', '⊥' => '&#8869;', '⋅' => '&#8901;', '⌈' => '&#8968;', '⌉' => '&#8969;', '⌊' => '&#8970;', '⌋' => '&#8971;', '◊' => '&#9674;', '♠' => '&#9824;', '♣' => '&#9827;', '♥' => '&#9829;', '♦' => '&#9830;', '⟨' => '&#9001;', '⟩' => '&#9002;',
  167.         /* '!' => '&#33;', */
  168.         /* '"' => '&#34;', */
  169.         /* '$' => '&#36;', */
  170.         /* '%' => '&#37;', */
  171.         /* '(' => '&#40;', */
  172.         /* ')' => '&#41;', */
  173.         /* '*' => '&#42;', */
  174.         /* '+' => '&#43;', */
  175.         /* ',' => '&#44;', */
  176.         /* '-' => '&#45;', */
  177.         /* '.' => '&#46;', */
  178.         /* '/' => '&#47;', */
  179.         /* ':' => '&#58;', */
  180.         /* '<' => '&#60;', */
  181.         /* '=' => '&#61;', */
  182.         /* '>' => '&#62;', */
  183.         /* '?' => '&#63;', */
  184.         '@' => '&#64;',
  185.         /* '[' => '&#91;', */
  186.         /* '\'' => '&#39;', */
  187.         /* '\\' => '&#92;', */
  188.         /* ']' => '&#93;', */
  189.         '^' => '&#94;',
  190.         /* '_' => '&#95;', */
  191.         '`' => '&#96;',
  192.         /* '{' => '&#123;', */
  193.         /* '|' => '&#124;', */
  194.         /* '}' => '&#125;', */
  195.         /* '~' => '&#126;', */
  196.         '✁' => '&#9985;', '✂' => '&#9986;', '✃' => '&#9987;', '✄' => '&#9988;', '✆' => '&#9990;', '✇' => '&#9991;', '✈' => '&#9992;', '✉' => '&#9993;', '✌' => '&#9996;', '✍' => '&#9997;', '✎' => '&#9998;', '✏' => '&#9999;', '✐' => '&#10000;', '✑' => '&#10001;', '✒' => '&#10002;', '✓' => '&#10003;', '✔' => '&#10004;', '✕' => '&#10005;', '✖' => '&#10006;', '✗' => '&#10007;', '✘' => '&#10008;', '✙' => '&#10009;', '✚' => '&#10010;', '✛' => '&#10011;', '✜' => '&#10012;', '✝' => '&#10013;', '✞' => '&#10014;', '✟' => '&#10015;', '✠' => '&#10016;', '✡' => '&#10017;', '✢' => '&#10018;', '✣' => '&#10019;', '✤' => '&#10020;', '✥' => '&#10021;', '✦' => '&#10022;', '✧' => '&#10023;', '✩' => '&#10025;', '✪' => '&#10026;', '✫' => '&#10027;', '✬' => '&#10028;', '✭' => '&#10029;', '✮' => '&#10030;', '✯' => '&#10031;', '✰' => '&#10032;', '✱' => '&#10033;', '✲' => '&#10034;', '✳' => '&#10035;', '✴' => '&#10036;', '✵' => '&#10037;', '✶' => '&#10038;', '✷' => '&#10039;', '✸' => '&#10040;', '✹' => '&#10041;', '✺' => '&#10042;', '✻' => '&#10043;', '✼' => '&#10044;', '✽' => '&#10045;', '✾' => '&#10046;', '✿' => '&#10047;', '❀' => '&#10048;', '❁' => '&#10049;', '❂' => '&#10050;', '❃' => '&#10051;', '❄' => '&#10052;', '❅' => '&#10053;', '❆' => '&#10054;', '❇' => '&#10055;', '❈' => '&#10056;', '❉' => '&#10057;', '❊' => '&#10058;', '❋' => '&#10059;', '❍' => '&#10061;', '❏' => '&#10063;', '❐' => '&#10064;', '❑' => '&#10065;', '❒' => '&#10066;', '❖' => '&#10070;', '❘' => '&#10072;', '❙' => '&#10073;', '❚' => '&#10074;', '❛' => '&#10075;', '❜' => '&#10076;', '❝' => '&#10077;', '❞' => '&#10078;', '❡' => '&#10081;', '❢' => '&#10082;', '❣' => '&#10083;', '❤' => '&#10084;', '❥' => '&#10085;', '❦' => '&#10086;', '❧' => '&#10087;', '❶' => '&#10102;', '❷' => '&#10103;', '❸' => '&#10104;', '❹' => '&#10105;', '❺' => '&#10106;', '❻' => '&#10107;', '❼' => '&#10108;', '❽' => '&#10109;', '❾' => '&#10110;', '❿' => '&#10111;', '➀' => '&#10112;', '➁' => '&#10113;', '➂' => '&#10114;', '➃' => '&#10115;', '➄' => '&#10116;', '➅' => '&#10117;', '➆' => '&#10118;', '➇' => '&#10119;', '➈' => '&#10120;', '➉' => '&#10121;', '➊' => '&#10122;', '➋' => '&#10123;', '➌' => '&#10124;', '➍' => '&#10125;', '➎' => '&#10126;', '➏' => '&#10127;', '➐' => '&#10128;', '➑' => '&#10129;', '➒' => '&#10130;', '➓' => '&#10131;', '➔' => '&#10132;', '➘' => '&#10136;', '➙' => '&#10137;', '➚' => '&#10138;', '➛' => '&#10139;', '➜' => '&#10140;', '➝' => '&#10141;', '➞' => '&#10142;', '➟' => '&#10143;', '➠' => '&#10144;', '➡' => '&#10145;', '➢' => '&#10146;', '➣' => '&#10147;', '➤' => '&#10148;', '➥' => '&#10149;', '➦' => '&#10150;', '➧' => '&#10151;', '➨' => '&#10152;', '➩' => '&#10153;', '➪' => '&#10154;', '➫' => '&#10155;', '➬' => '&#10156;', '➭' => '&#10157;', '➮' => '&#10158;', '➯' => '&#10159;', '➱' => '&#10161;', '➲' => '&#10162;', '➳' => '&#10163;', '➴' => '&#10164;', '➵' => '&#10165;', '➶' => '&#10166;', '➷' => '&#10167;', '➸' => '&#10168;', '➹' => '&#10169;', '➺' => '&#10170;', '➻' => '&#10171;', '➼' => '&#10172;', '➽' => '&#10173;', '➾' => '&#10174;');
  197.  
  198.         foreach($a as $k => $v) {
  199.  
  200.             $s = str_replace($k, $v, $s);
  201.         }
  202.  
  203.         return $s;
  204.     }
  205.  
  206.     public function named_symbs_to_dec_ents($s) {
  207.  
  208.         $a = null;
  209.  
  210.         $a = array('&nbsp;' => '&#160;', '&iexcl;' => '&#161;', '&cent;' => '&#162;', '&pound;' => '&#163;', '&curren;' => '&#164;', '&yen;' => '&#165;', '&brvbar;' => '&#166;', '&sect;' => '&#167;', '&uml;' => '&#168;', '&copy;' => '&#169;', '&ordf;' => '&#170;', '&laquo;' => '&#171;', '&not;' => '&#172;', '&shy;' => '&#173;', '&reg;' => '&#174;', '&macr;' => '&#175;', '&deg;' => '&#176;', '&plusmn;' => '&#177;', '&sup2;' => '&#178;', '&sup3;' => '&#179;', '&acute;' => '&#180;', '&micro;' => '&#181;', '&para;' => '&#182;', '&middot;' => '&#183;', '&cedil;' => '&#184;', '&sup1;' => '&#185;', '&ordm;' => '&#186;', '&raquo;' => '&#187;', '&frac14;' => '&#188;', '&frac12;' => '&#189;', '&frac34;' => '&#190;', '&iquest;' => '&#191;', '&Agrave;' => '&#192;', '&Aacute;' => '&#193;', '&Acirc;' => '&#194;', '&Atilde;' => '&#195;', '&Auml;' => '&#196;', '&Aring;' => '&#197;', '&AElig;' => '&#198;', '&Ccedil;' => '&#199;', '&Egrave;' => '&#200;', '&Eacute;' => '&#201;', '&Ecirc;' => '&#202;', '&Euml;' => '&#203;', '&Igrave;' => '&#204;', '&Iacute;' => '&#205;', '&Icirc;' => '&#206;', '&Iuml;' => '&#207;', '&ETH;' => '&#208;', '&Ntilde;' => '&#209;', '&Ograve;' => '&#210;', '&Oacute;' => '&#211;', '&Ocirc;' => '&#212;', '&Otilde;' => '&#213;', '&Ouml;' => '&#214;', '&times;' => '&#215;', '&Oslash;' => '&#216;', '&Ugrave;' => '&#217;', '&Uacute;' => '&#218;', '&Ucirc;' => '&#219;', '&Uuml;' => '&#220;', '&Yacute;' => '&#221;', '&THORN;' => '&#222;', '&szlig;' => '&#223;', '&agrave;' => '&#224;', '&aacute;' => '&#225;', '&acirc;' => '&#226;', '&atilde;' => '&#227;', '&auml;' => '&#228;', '&aring;' => '&#229;', '&aelig;' => '&#230;', '&ccedil;' => '&#231;', '&egrave;' => '&#232;', '&eacute;' => '&#233;', '&ecirc;' => '&#234;', '&euml;' => '&#235;', '&igrave;' => '&#236;', '&iacute;' => '&#237;', '&icirc;' => '&#238;', '&iuml;' => '&#239;', '&eth;' => '&#240;', '&ntilde;' => '&#241;', '&ograve;' => '&#242;', '&oacute;' => '&#243;', '&ocirc;' => '&#244;', '&otilde;' => '&#245;', '&ouml;' => '&#246;', '&divide;' => '&#247;', '&oslash;' => '&#248;', '&ugrave;' => '&#249;', '&uacute;' => '&#250;', '&ucirc;' => '&#251;', '&uuml;' => '&#252;', '&yacute;' => '&#253;', '&thorn;' => '&#254;', '&yuml;' => '&#255;', '&fnof;' => '&#402;', '&Alpha;' => '&#913;', '&Beta;' => '&#914;', '&Gamma;' => '&#915;', '&Delta;' => '&#916;', '&Epsilon;' => '&#917;', '&Zeta;' => '&#918;', '&Eta;' => '&#919;', '&Theta;' => '&#920;', '&Iota;' => '&#921;', '&Kappa;' => '&#922;', '&Lambda;' => '&#923;', '&Mu;' => '&#924;', '&Nu;' => '&#925;', '&Xi;' => '&#926;', '&Omicron;' => '&#927;', '&Pi;' => '&#928;', '&Rho;' => '&#929;', '&Sigma;' => '&#931;', '&Tau;' => '&#932;', '&Upsilon;' => '&#933;', '&Phi;' => '&#934;', '&Chi;' => '&#935;', '&Psi;' => '&#936;', '&Omega;' => '&#937;', '&alpha;' => '&#945;', '&beta;' => '&#946;', '&gamma;' => '&#947;', '&delta;' => '&#948;', '&epsilon;' => '&#949;', '&zeta;' => '&#950;', '&eta;' => '&#951;', '&theta;' => '&#952;', '&iota;' => '&#953;', '&kappa;' => '&#954;', '&lambda;' => '&#955;', '&mu;' => '&#956;', '&nu;' => '&#957;', '&xi;' => '&#958;', '&omicron;' => '&#959;', '&pi;' => '&#960;', '&rho;' => '&#961;', '&sigmaf;' => '&#962;', '&sigma;' => '&#963;', '&tau;' => '&#964;', '&upsilon;' => '&#965;', '&phi;' => '&#966;', '&chi;' => '&#967;', '&psi;' => '&#968;', '&omega;' => '&#969;', '&thetasym;' => '&#977;', '&upsih;' => '&#978;', '&piv;' => '&#982;', '&bull;' => '&#8226;', '&hellip;' => '&#8230;', '&prime;' => '&#8242;', '&Prime;' => '&#8243;', '&oline;' => '&#8254;', '&frasl;' => '&#8260;', '&weierp;' => '&#8472;', '&image;' => '&#8465;', '&real;' => '&#8476;', '&trade;' => '&#8482;', '&alefsym;' => '&#8501;', '&larr;' => '&#8592;', '&uarr;' => '&#8593;', '&rarr;' => '&#8594;', '&darr;' => '&#8595;', '&harr;' => '&#8596;', '&crarr;' => '&#8629;', '&lArr;' => '&#8656;', '&uArr;' => '&#8657;', '&rArr;' => '&#8658;', '&dArr;' => '&#8659;', '&hArr;' => '&#8660;', '&forall;' => '&#8704;', '&part;' => '&#8706;', '&exist;' => '&#8707;', '&empty;' => '&#8709;', '&nabla;' => '&#8711;', '&isin;' => '&#8712;', '&notin;' => '&#8713;', '&ni;' => '&#8715;', '&prod;' => '&#8719;', '&sum;' => '&#8721;', '&minus;' => '&#8722;', '&lowast;' => '&#8727;', '&radic;' => '&#8730;', '&prop;' => '&#8733;', '&infin;' => '&#8734;', '&ang;' => '&#8736;', '&and;' => '&#8743;', '&or;' => '&#8744;', '&cap;' => '&#8745;', '&cup;' => '&#8746;', '&int;' => '&#8747;', '&there4;' => '&#8756;', '&sim;' => '&#8764;', '&cong;' => '&#8773;', '&asymp;' => '&#8776;', '&ne;' => '&#8800;', '&equiv;' => '&#8801;', '&le;' => '&#8804;', '&ge;' => '&#8805;', '&sub;' => '&#8834;', '&sup;' => '&#8835;', '&nsub;' => '&#8836;', '&sube;' => '&#8838;', '&supe;' => '&#8839;', '&oplus;' => '&#8853;', '&otimes;' => '&#8855;', '&perp;' => '&#8869;', '&sdot;' => '&#8901;', '&lceil;' => '&#8968;', '&rceil;' => '&#8969;', '&lfloor;' => '&#8970;', '&rfloor;' => '&#8971;', '&lang;' => '&#9001;', '&rang;' => '&#9002;', '&loz;' => '&#9674;', '&spades;' => '&#9824;', '&clubs;' => '&#9827;', '&hearts;' => '&#9829;', '&diams;' => '&#9830;', '&OElig;' => '&#338;', '&oelig;' => '&#339;', '&Scaron;' => '&#352;', '&scaron;' => '&#353;', '&Yuml;' => '&#376;', '&circ;' => '&#710;', '&tilde;' => '&#732;', '&ensp;' => '&#8194;', '&emsp;' => '&#8195;', '&thinsp;' => '&#8201;', '&zwnj;' => '&#8204;', '&zwj;' => '&#8205;', '&lrm;' => '&#8206;', '&rlm;' => '&#8207;', '&ndash;' => '&#8211;', '&mdash;' => '&#8212;', '&lsquo;' => '&#8216;', '&rsquo;' => '&#8217;', '&sbquo;' => '&#8218;', '&ldquo;' => '&#8220;', '&rdquo;' => '&#8221;', '&bdquo;' => '&#8222;', '&dagger;' => '&#8224;', '&Dagger;' => '&#8225;', '&permil;' => '&#8240;', '&lsaquo;' => '&#8249;', '&rsaquo;' => '&#8250;', '&euro;' => '&#8364;');
  211.  
  212.         foreach($a as $k => $v) {
  213.  
  214.             $s = str_replace($k, $v, $s);
  215.         }
  216.  
  217.         return $s;
  218.     }
  219.  
  220.     public function latin_text_chars_to_dec_ents($s) {
  221.  
  222.         $a = null;
  223.  
  224.         $a = array('A' => '&#65;', 'B' => '&#66;', 'C' => '&#67;', 'D' => '&#68;', 'E' => '&#69;', 'F' => '&#70;', 'G' => '&#71;', 'H' => '&#72;', 'I' => '&#73;', 'J' => '&#74;', 'K' => '&#75;', 'L' => '&#76;', 'M' => '&#77;', 'N' => '&#78;', 'O' => '&#79;', 'P' => '&#80;', 'Q' => '&#81;', 'R' => '&#82;', 'S' => '&#83;', 'T' => '&#84;', 'U' => '&#85;', 'V' => '&#86;', 'W' => '&#87;', 'X' => '&#88;', 'Y' => '&#89;', 'Z' => '&#90;', 'a' => '&#97;', 'b' => '&#98;', 'c' => '&#99;', 'd' => '&#100;', 'e' => '&#101;', 'f' => '&#102;', 'g' => '&#103;', 'h' => '&#104;', 'i' => '&#105;', 'j' => '&#106;', 'k' => '&#107;', 'l' => '&#108;', 'm' => '&#109;', 'n' => '&#110;', 'o' => '&#111;', 'p' => '&#112;', 'q' => '&#113;', 'r' => '&#114;', 's' => '&#115;', 't' => '&#116;', 'u' => '&#117;', 'v' => '&#118;', 'w' => '&#119;', 'x' => '&#120;', 'y' => '&#121;', 'z' => '&#122;');
  225.  
  226.         foreach($a as $k => $v) {
  227.  
  228.             $s = str_replace($k, $v, $s);
  229.         }
  230.  
  231.         return $s;
  232.     }
  233.  
  234.     public function acc_text_to_dec_ents($s) {
  235.  
  236.         $a = null;
  237.  
  238.         $a = array('Á' => '&#193;', 'Â' => '&#194;', 'Æ' => '&#198;', 'À' => '&#192;', 'Å' => '&#197;', 'Ã' => '&#195;', 'Ä' => '&#196;', 'Ç' => '&#199;', 'É' => '&#201;', 'Ê' => '&#202;', 'È' => '&#200;', 'Ð' => '&#208;', 'Ë' => '&#203;', 'ƒ' => '&#402;', 'Í' => '&#205;', 'Î' => '&#206;', 'Ì' => '&#204;', 'Ï' => '&#207;', 'Ñ' => '&#209;', 'Ó' => '&#211;', 'Ô' => '&#212;', 'Œ' => '&#338;', 'Ò' => '&#210;', 'Ø' => '&#216;', 'Õ' => '&#213;', 'Ö' => '&#214;', 'Š' => '&#352;', 'ß' => '&#223;', 'Þ' => '&#222;', 'Ú' => '&#218;', 'Û' => '&#219;', 'Ù' => '&#217;', 'ü' => '&#252;', 'Ý' => '&#221;', 'Ÿ' => '&#376;', 'á' => '&#225;', 'â' => '&#226;', 'æ' => '&#230;', 'à' => '&#224;', 'å' => '&#229;', 'ã' => '&#227;', 'ä' => '&#228;', 'ç' => '&#231;', 'é' => '&#233;', 'ê' => '&#234;', 'è' => '&#232;', 'ð' => '&#240;', 'ë' => '&#235;', 'ƒ' => '&#402;', 'í' => '&#237;', 'î' => '&#238;', 'ì' => '&#236;', 'ï' => '&#239;', 'ñ' => '&#241;', 'ó' => '&#243;', 'ô' => '&#244;', 'œ' => '&#339;', 'ò' => '&#242;', 'ø' => '&#248;', 'õ' => '&#245;', 'ö' => '&#246;', 'š' => '&#353;', 'ß' => '&#223;', 'þ' => '&#254;', 'ú' => '&#250;', 'û' => '&#251;', 'ù' => '&#249;', 'Ü' => '&#220;', 'ý' => '&#253;', 'ÿ' => '&#255;');
  239.  
  240.         foreach($a as $k => $v) {
  241.  
  242.             $s = str_replace($k, $v, $s);
  243.         }
  244.  
  245.         return $s;
  246.     }
  247.  
  248.     public function acc_named_to_dec_ents($s) {
  249.  
  250.         $a = null;
  251.  
  252.         $a = array('&Aacute;' => '&#193;', '&Acirc;' => '&#194;', '&AElig;' => '&#198;', '&Agrave;' => '&#192;', '&Aring;' => '&#197;', '&Atilde;' => '&#195;', '&Auml;' => '&#196;', '&Ccedil;' => '&#199;', '&Eacute;' => '&#201;', '&Ecirc;' => '&#202;', '&Egrave;' => '&#200;', '&ETH;' => '&#208;', '&Euml;' => '&#203;', '&fnof;' => '&#402;', '&Iacute;' => '&#205;', '&Icirc;' => '&#206;', '&Igrave;' => '&#204;', '&Iuml;' => '&#207;', '&Ntilde;' => '&#209;', '&Oacute;' => '&#211;', '&Ocirc;' => '&#212;', '&OElig;' => '&#338;', '&Ograve;' => '&#210;', '&Oslash;' => '&#216;', '&Otilde;' => '&#213;', '&Ouml;' => '&#214;', '&Scaron;' => '&#352;', '&szlig;' => '&#223;', '&THORN;' => '&#222;', '&Uacute;' => '&#218;', '&Ucirc;' => '&#219;', '&Ugrave;' => '&#217;', '&uuml;' => '&#252;', '&Yacute;' => '&#221;', '&Yuml;' => '&#376;', '&aacute;' => '&#225;', '&acirc;' => '&#226;', '&aelig;' => '&#230;', '&agrave;' => '&#224;', '&aring;' => '&#229;', '&atilde;' => '&#227;', '&auml;' => '&#228;', '&ccedil;' => '&#231;', '&eacute;' => '&#233;', '&ecirc;' => '&#234;', '&egrave;' => '&#232;', '&eth;' => '&#240;', '&euml;' => '&#235;', '&fnof;' => '&#402;', '&iacute;' => '&#237;', '&icirc;' => '&#238;', '&igrave;' => '&#236;', '&iuml;' => '&#239;', '&ntilde;' => '&#241;', '&oacute;' => '&#243;', '&ocirc;' => '&#244;', '&oelig;' => '&#339;', '&ograve;' => '&#242;', '&oslash;' => '&#248;', '&otilde;' => '&#245;', '&ouml;' => '&#246;', '&scaron;' => '&#353;', '&szlig;' => '&#223;', '&thorn;' => '&#254;', '&uacute;' => '&#250;', '&ucirc;' => '&#251;', '&ugrave;' => '&#249;', '&Uuml;' => '&#220;', '&yacute;' => '&#253;', '&yuml;' => '&#255;');
  253.  
  254.         foreach($a as $k => $v) {
  255.  
  256.             $s = str_replace($k, $v, $s);
  257.         }
  258.  
  259.         return $s;
  260.     }
  261.  
  262.     public function cyr_text_chars_to_dec_ents($s) {
  263.  
  264.         $a = null;
  265.  
  266.         $a = array('А' => '&#1040;', 'Б' => '&#1041;', 'В' => '&#1042;', 'Г' => '&#1043;', 'Д' => '&#1044;', 'Е' => '&#1045;', 'Ж' => '&#1046;', 'З' => '&#1047;', 'И' => '&#1048;', 'Й' => '&#1049;', 'К' => '&#1050;', 'Л' => '&#1051;', 'М' => '&#1052;', 'Н' => '&#1053;', 'О' => '&#1054;', 'П' => '&#1055;', 'Р' => '&#1056;', 'С' => '&#1057;', 'Т' => '&#1058;', 'У' => '&#1059;', 'Ф' => '&#1060;', 'Х' => '&#1061;', 'Ц' => '&#1062;', 'Ч' => '&#1063;', 'Ш' => '&#1064;', 'Щ' => '&#1065;', 'Ъ' => '&#1066;', 'Ы' => '&#1067;', 'Ь' => '&#1068;', 'Э' => '&#1069;', 'Ю' => '&#1070;', 'Я' => '&#1071;', 'а' => '&#1072;', 'б' => '&#1073;', 'в' => '&#1074;', 'г' => '&#1075;', 'д' => '&#1076;', 'е' => '&#1077;', 'ж' => '&#1078;', 'з' => '&#1079;', 'и' => '&#1080;', 'й' => '&#1081;', 'к' => '&#1082;', 'л' => '&#1083;', 'м' => '&#1084;', 'н' => '&#1085;', 'о' => '&#1086;', 'п' => '&#1087;', 'р' => '&#1088;', 'с' => '&#1089;', 'т' => '&#1090;', 'у' => '&#1091;', 'ф' => '&#1092;', 'х' => '&#1093;', 'ц' => '&#1094;', 'ч' => '&#1095;', 'ш' => '&#1096;', 'щ' => '&#1097;', 'ъ' => '&#1098;', 'ы' => '&#1099;', 'ь' => '&#1100;', 'э' => '&#1101;', 'ю' => '&#1102;', 'я' => '&#1103;');
  267.  
  268.         foreach($a as $k => $v) {
  269.  
  270.             $s = str_replace($k, $v, $s);
  271.         }
  272.  
  273.         return $s;
  274.     }
  275.  
  276.     public function cyr_named_chars_to_dec_ents($s) {
  277.  
  278.         $a = null;
  279.  
  280.         $a = array('&Acy;' => '&#1040;', '&Bcy;' => '&#1041;', '&CHcy;' => '&#1063;', '&DJcy;' => '&#1026;', '&DScy;' => '&#1029;', '&DZcy;' => '&#1039;', '&Dcy;' => '&#1044;', '&Ecy;' => '&#1069;', '&Fcy;' => '&#1060;', '&GJcy;' => '&#1027;', '&Gcy;' => '&#1043;', '&HARDcy;' => '&#1066;', '&IEcy;' => '&#1045;', '&IOcy;' => '&#1025;', '&Icy;' => '&#1048;', '&Iukcy;' => '&#1030;', '&Jcy;' => '&#1049;', '&Jsercy;' => '&#1032;', '&Jukcy;' => '&#1028;', '&KHcy;' => '&#1061;', '&KJcy;' => '&#1036;', '&Kcy;' => '&#1050;', '&LJcy;' => '&#1033;', '&Lcy;' => '&#1051;', '&Mcy;' => '&#1052;', '&NJcy;' => '&#1034;', '&Ncy;' => '&#1053;', '&Ocy;' => '&#1054;', '&Pcy;' => '&#1055;', '&Rcy;' => '&#1056;', '&SHCHcy;' => '&#1065;', '&SHcy;' => '&#1064;', '&SOFTcy;' => '&#1068;', '&Scy;' => '&#1057;', '&TSHcy;' => '&#1035;', '&TScy;' => '&#1062;', '&Tcy;' => '&#1058;', '&Ubrcy;' => '&#1038;', '&Ucy;' => '&#1059;', '&Vcy;' => '&#1042;', '&YAcy;' => '&#1071;', '&YIcy;' => '&#1031;', '&YUcy;' => '&#1070;', '&Ycy;' => '&#1067;', '&ZHcy;' => '&#1046;', '&Zcy;' => '&#1047;', '&acy;' => '&#1072;', '&bcy;' => '&#1073;', '&chcy;' => '&#1095;', '&dcy;' => '&#1076;', '&djcy;' => '&#1106;', '&dscy;' => '&#1109;', '&dzcy;' => '&#1119;', '&ecy;' => '&#1101;', '&fcy;' => '&#1092;', '&gcy;' => '&#1075;', '&gjcy;' => '&#1107;', '&hardcy;' => '&#1098;', '&icy;' => '&#1080;', '&iecy;' => '&#1077;', '&iocy;' => '&#1105;', '&iukcy;' => '&#1110;', '&jcy;' => '&#1081;', '&jsercy;' => '&#1112;', '&jukcy;' => '&#1108;', '&kcy;' => '&#1082;', '&khcy;' => '&#1093;', '&kjcy;' => '&#1116;', '&lcy;' => '&#1083;', '&ljcy;' => '&#1113;', '&mcy;' => '&#1084;', '&ncy;' => '&#1085;', '&njcy;' => '&#1114;', '&ocy;' => '&#1086;', '&pcy;' => '&#1087;', '&rcy;' => '&#1088;', '&scy;' => '&#1089;', '&shchcy;' => '&#1097;', '&shcy;' => '&#1096;', '&softcy;' => '&#1100;', '&tcy;' => '&#1090;', '&tscy;' => '&#1094;', '&tshcy;' => '&#1115;', '&ubrcy;' => '&#1118;', '&ucy;' => '&#1091;', '&vcy;' => '&#1074;', '&yacy;' => '&#1103;', '&ycy;' => '&#1099;', '&yicy;' => '&#1111;', '&yucy;' => '&#1102;', '&zcy;' => '&#1079;', '&zhcy;' => '&#1078;');
  281.  
  282.         foreach($a as $k => $v) {
  283.  
  284.             $s = str_replace($k, $v, $s);
  285.         }
  286.  
  287.         return $s;
  288.     }
  289.  
  290.     public function diacr_text_chars_to_dec_ents($s) {
  291.  
  292.         $a = null;
  293.  
  294.         $a = array(
  295.                     'ae' => '&#228;', 'Ae' => '&#196;', 'cz' => '&#231;', 'dj' => '&#x111;', 'Dj' => '&#x110;', 'oe' => '&#246;', 'Oe' => '&#214;',
  296.                     /* 'ss' => '&#223;', */
  297.                     /* 'Ss' => '&#223;', */
  298.                     'ue' => '&#252;', 'Ue' => '&#220;'
  299.                     );
  300.  
  301.         foreach($a as $k => $v) {
  302.  
  303.             $s = str_replace($k, $v, $s);
  304.         }
  305.  
  306.         return $s;
  307.     }
  308.  
  309.     public function hex_ents_to_dec_ents($s) {
  310.  
  311.         $a = null;
  312.  
  313.         $a = array(
  314.                     '&#x0;' => '&#0;','&#x104;' => '&#260;','&#x105;' => '&#261;','&#x106;' => '&#262;','&#x107;' => '&#263;','&#x10;' => '&#16;','&#x118;' => '&#280;','&#x119;' => '&#281;','&#x11;' => '&#17;','&#x12;' => '&#18;','&#x13;' => '&#19;','&#x141;' => '&#321;','&#x142;' => '&#322;','&#x143;' => '&#323;','&#x144;' => '&#324;','&#x14;' => '&#20;','&#x152;' => '&#338;','&#x153;' => '&#339;','&#x15;' => '&#21;','&#x15a;' => '&#346;','&#x15b;' => '&#347;','&#x160;' => '&#352;','&#x161;' => '&#353;','&#x16;' => '&#22;','&#x178;' => '&#376;','&#x179;' => '&#377;','&#x17;' => '&#23;','&#x17a;' => '&#378;','&#x17b;' => '&#379;','&#x17c;' => '&#380;','&#x18;' => '&#24;','&#x192;' => '&#402;','&#x19;' => '&#25;','&#x1;' => '&#1;','&#x1a;' => '&#26;','&#x1b;' => '&#27;','&#x1c;' => '&#28;','&#x1d;' => '&#29;','&#x1e;' => '&#30;','&#x1f;' => '&#31;','&#x1fbf;' => '&#8127;','&#x1ffe;' => '&#8190;','&#x2002;' => '&#8194;','&#x2003;' => '&#8195;','&#x2009;' => '&#8201;','&#x200C;' => '&#8204;','&#x200D;' => '&#8205;','&#x200E;' => '&#8206;','&#x200F;' => '&#8207;','&#x200c;' => '&#8204;','&#x200d;' => '&#8205;','&#x200e;' => '&#8206;','&#x200f;' => '&#8207;','&#x2013;' => '&#8211;','&#x2014;' => '&#8212;','&#x2018;' => '&#8216;','&#x2019;' => '&#8217;','&#x201A;' => '&#8218;','&#x201C;' => '&#8220;','&#x201D;' => '&#8221;','&#x201E;' => '&#8222;','&#x201a;' => '&#8218;','&#x201c;' => '&#8220;','&#x201d;' => '&#8221;','&#x201e;' => '&#8222;','&#x2020;' => '&#8224;','&#x2021;' => '&#8225;','&#x2022;' => '&#8226;','&#x2026;' => '&#8230;','&#x2030;' => '&#8240;','&#x2032;' => '&#8242;','&#x2033;' => '&#8243;','&#x2039;' => '&#8249;','&#x203A;' => '&#8250;','&#x203E;' => '&#8254;','&#x203a;' => '&#8250;','&#x203e;' => '&#8254;','&#x2044;' => '&#8260;','&#x20;' => '&#32;','&#x20AC;' => '&#8364;','&#x20ac;' => '&#8364;','&#x2111;' => '&#8465;','&#x2118;' => '&#8472;','&#x211C;' => '&#8476;','&#x211c;' => '&#8476;','&#x2122;' => '&#8482;','&#x2135;' => '&#8501;','&#x2190;' => '&#8592;','&#x2191;' => '&#8593;','&#x2192;' => '&#8594;','&#x2193;' => '&#8595;','&#x2194;' => '&#8596;','&#x2195;' => '&#8597;','&#x2196;' => '&#8598;','&#x2197;' => '&#8599;','&#x2198;' => '&#8600;','&#x2199;' => '&#8601;','&#x219a;' => '&#8602;','&#x219b;' => '&#8603;','&#x219d;' => '&#8605;','&#x219e;' => '&#8606;','&#x21;' => '&#33;','&#x21B5;' => '&#8629;','&#x21D0;' => '&#8656;','&#x21D1;' => '&#8657;','&#x21D2;' => '&#8658;','&#x21D3;' => '&#8659;','&#x21D4;' => '&#8660;','&#x21a0;' => '&#8608;','&#x21a2;' => '&#8610;','&#x21a3;' => '&#8611;','&#x21a6;' => '&#8614;','&#x21a9;' => '&#8617;','&#x21aa;' => '&#8618;','&#x21ab;' => '&#8619;','&#x21ac;' => '&#8620;','&#x21ad;' => '&#8621;','&#x21ae;' => '&#8622;','&#x21b0;' => '&#8624;','&#x21b1;' => '&#8625;','&#x21b5;' => '&#8629;','&#x21b6;' => '&#8630;','&#x21b7;' => '&#8631;','&#x21ba;' => '&#8634;','&#x21bb;' => '&#8635;','&#x21bc;' => '&#8636;','&#x21bd;' => '&#8637;','&#x21be;' => '&#8638;','&#x21bf;' => '&#8639;','&#x21c0;' => '&#8640;','&#x21c1;' => '&#8641;','&#x21c2;' => '&#8642;','&#x21c3;' => '&#8643;','&#x21c4;' => '&#8644;','&#x21c6;' => '&#8646;','&#x21c7;' => '&#8647;','&#x21c8;' => '&#8648;','&#x21c9;' => '&#8649;','&#x21ca;' => '&#8650;','&#x21cb;' => '&#8651;','&#x21cc;' => '&#8652;','&#x21cd;' => '&#8653;','&#x21ce;' => '&#8654;','&#x21cf;' => '&#8655;','&#x21d0;' => '&#8656;','&#x21d1;' => '&#8657;','&#x21d2;' => '&#8658;','&#x21d3;' => '&#8659;','&#x21d4;' => '&#8660;','&#x21d5;' => '&#8661;','&#x21da;' => '&#8666;','&#x21db;' => '&#8667;','&#x2200;' => '&#8704;','&#x2202;' => '&#8706;','&#x2203;' => '&#8707;','&#x2205;' => '&#8709;','&#x2207;' => '&#8711;','&#x2208;' => '&#8712;','&#x2209;' => '&#8713;','&#x220B;' => '&#8715;','&#x220F;' => '&#8719;','&#x220b;' => '&#8715;','&#x220f;' => '&#8719;','&#x2211;' => '&#8721;','&#x2212;' => '&#8722;','&#x2217;' => '&#8727;','&#x221A;' => '&#8730;','&#x221D;' => '&#8733;','&#x221E;' => '&#8734;','&#x221a;' => '&#8730;','&#x221d;' => '&#8733;','&#x221e;' => '&#8734;','&#x2220;' => '&#8736;','&#x2227;' => '&#8743;','&#x2228;' => '&#8744;','&#x2229;' => '&#8745;','&#x222A;' => '&#8746;','&#x222B;' => '&#8747;','&#x222a;' => '&#8746;','&#x222b;' => '&#8747;','&#x2234;' => '&#8756;','&#x223C;' => '&#8764;','&#x223c;' => '&#8764;','&#x2245;' => '&#8773;','&#x2248;' => '&#8776;','&#x2260;' => '&#8800;','&#x2261;' => '&#8801;','&#x2264;' => '&#8804;','&#x2265;' => '&#8805;','&#x2282;' => '&#8834;','&#x2283;' => '&#8835;','&#x2284;' => '&#8836;','&#x2286;' => '&#8838;','&#x2287;' => '&#8839;','&#x2295;' => '&#8853;','&#x2297;' => '&#8855;','&#x22;' => '&#34;','&#x22A5;' => '&#8869;','&#x22C5;' => '&#8901;','&#x22a5;' => '&#8869;','&#x22b8;' => '&#8888;','&#x22c5;' => '&#8901;','&#x2308;' => '&#8968;','&#x2309;' => '&#8969;','&#x230A;' => '&#8970;','&#x230B;' => '&#8971;','&#x230a;' => '&#8970;','&#x230b;' => '&#8971;','&#x2329;' => '&#9001;','&#x232A;' => '&#9002;','&#x232a;' => '&#9002;','&#x23;' => '&#35;','&#x24;' => '&#36;','&#x25;' => '&#37;','&#x25CA;' => '&#9674;','&#x25ca;' => '&#9674;','&#x2660;' => '&#9824;','&#x2663;' => '&#9827;','&#x2665;' => '&#9829;','&#x2666;' => '&#9830;','&#x26;' => '&#38;','&#x2701;' => '&#9985;','&#x2702;' => '&#9986;','&#x2703;' => '&#9987;','&#x2704;' => '&#9988;','&#x2706;' => '&#9990;','&#x2707;' => '&#9991;','&#x2708;' => '&#9992;','&#x2709;' => '&#9993;','&#x270C;' => '&#9996;','&#x270D;' => '&#9997;','&#x270E;' => '&#9998;','&#x270F;' => '&#9999;','&#x2710;' => '&#10000;','&#x2711;' => '&#10001;','&#x2712;' => '&#10002;','&#x2713;' => '&#10003;','&#x2714;' => '&#10004;','&#x2715;' => '&#10005;','&#x2716;' => '&#10006;','&#x2717;' => '&#10007;','&#x2718;' => '&#10008;','&#x2719;' => '&#10009;','&#x271A;' => '&#10010;','&#x271B;' => '&#10011;','&#x271C;' => '&#10012;','&#x271D;' => '&#10013;','&#x271E;' => '&#10014;','&#x271F;' => '&#10015;','&#x2720;' => '&#10016;','&#x2721;' => '&#10017;','&#x2722;' => '&#10018;','&#x2723;' => '&#10019;','&#x2724;' => '&#10020;','&#x2725;' => '&#10021;','&#x2726;' => '&#10022;','&#x2727;' => '&#10023;','&#x2729;' => '&#10025;','&#x272A;' => '&#10026;','&#x272B;' => '&#10027;','&#x272C;' => '&#10028;','&#x272D;' => '&#10029;','&#x272E;' => '&#10030;','&#x272F;' => '&#10031;','&#x2730;' => '&#10032;','&#x2731;' => '&#10033;','&#x2732;' => '&#10034;','&#x2733;' => '&#10035;','&#x2734;' => '&#10036;','&#x2735;' => '&#10037;','&#x2736;' => '&#10038;','&#x2737;' => '&#10039;','&#x2738;' => '&#10040;','&#x2739;' => '&#10041;','&#x273A;' => '&#10042;','&#x273B;' => '&#10043;','&#x273C;' => '&#10044;','&#x273D;' => '&#10045;','&#x273E;' => '&#10046;','&#x273F;' => '&#10047;','&#x2740;' => '&#10048;','&#x2741;' => '&#10049;','&#x2742;' => '&#10050;','&#x2743;' => '&#10051;','&#x2744;' => '&#10052;','&#x2745;' => '&#10053;','&#x2746;' => '&#10054;','&#x2747;' => '&#10055;','&#x2748;' => '&#10056;','&#x2749;' => '&#10057;','&#x274A;' => '&#10058;','&#x274B;' => '&#10059;','&#x274D;' => '&#10061;','&#x274F;' => '&#10063;','&#x2750;' => '&#10064;','&#x2751;' => '&#10065;','&#x2752;' => '&#10066;','&#x2756;' => '&#10070;','&#x2758;' => '&#10072;','&#x2759;' => '&#10073;','&#x275A;' => '&#10074;','&#x275B;' => '&#10075;','&#x275C;' => '&#10076;','&#x275D;' => '&#10077;','&#x275E;' => '&#10078;','&#x2761;' => '&#10081;','&#x2762;' => '&#10082;','&#x2763;' => '&#10083;','&#x2764;' => '&#10084;','&#x2765;' => '&#10085;','&#x2766;' => '&#10086;','&#x2767;' => '&#10087;','&#x2776;' => '&#10102;','&#x2777;' => '&#10103;','&#x2778;' => '&#10104;','&#x2779;' => '&#10105;','&#x277A;' => '&#10106;','&#x277B;' => '&#10107;','&#x277C;' => '&#10108;','&#x277D;' => '&#10109;','&#x277E;' => '&#10110;','&#x277F;' => '&#10111;','&#x2780;' => '&#10112;','&#x2781;' => '&#10113;','&#x2782;' => '&#10114;','&#x2783;' => '&#10115;','&#x2784;' => '&#10116;','&#x2785;' => '&#10117;','&#x2786;' => '&#10118;','&#x2787;' => '&#10119;','&#x2788;' => '&#10120;','&#x2789;' => '&#10121;','&#x278A;' => '&#10122;','&#x278B;' => '&#10123;','&#x278C;' => '&#10124;','&#x278D;' => '&#10125;','&#x278E;' => '&#10126;','&#x278F;' => '&#10127;','&#x2790;' => '&#10128;','&#x2791;' => '&#10129;','&#x2792;' => '&#10130;','&#x2793;' => '&#10131;','&#x2794;' => '&#10132;','&#x2798;' => '&#10136;','&#x2799;' => '&#10137;','&#x279A;' => '&#10138;','&#x279B;' => '&#10139;','&#x279C;' => '&#10140;','&#x279D;' => '&#10141;','&#x279E;' => '&#10142;','&#x279F;' => '&#10143;','&#x27;' => '&#39;','&#x27A0;' => '&#10144;','&#x27A1;' => '&#10145;','&#x27A2;' => '&#10146;','&#x27A3;' => '&#10147;','&#x27A4;' => '&#10148;','&#x27A5;' => '&#10149;','&#x27A6;' => '&#10150;','&#x27A7;' => '&#10151;','&#x27A8;' => '&#10152;','&#x27A9;' => '&#10153;','&#x27AA;' => '&#10154;','&#x27AB;' => '&#10155;','&#x27AC;' => '&#10156;','&#x27AD;' => '&#10157;','&#x27AE;' => '&#10158;','&#x27AF;' => '&#10159;','&#x27B1;' => '&#10161;','&#x27B2;' => '&#10162;','&#x27B3;' => '&#10163;','&#x27B4;' => '&#10164;','&#x27B5;' => '&#10165;','&#x27B6;' => '&#10166;','&#x27B7;' => '&#10167;','&#x27B8;' => '&#10168;','&#x27B9;' => '&#10169;','&#x27BA;' => '&#10170;','&#x27BB;' => '&#10171;','&#x27BC;' => '&#10172;','&#x27BD;' => '&#10173;','&#x27BE;' => '&#10174;','&#x27f7;' => '&#10231;','&#x27f8;' => '&#10232;','&#x27f9;' => '&#10233;','&#x27fa;' => '&#10234;','&#x28;' => '&#40;','&#x29;' => '&#41;','&#x2;' => '&#2;','&#x2C6;' => '&#710;','&#x2DC;' => '&#732;','&#x2a;' => '&#42;','&#x2b;' => '&#43;','&#x2c6;' => '&#710;','&#x2c7;' => '&#711;','&#x2c;' => '&#44;','&#x2d8;' => '&#728;','&#x2d;' => '&#45;','&#x2da;' => '&#730;','&#x2db;' => '&#731;','&#x2dc;' => '&#732;','&#x2dd;' => '&#733;','&#x2e;' => '&#46;','&#x2f3;' => '&#755;','&#x2f;' => '&#47;','&#x309;' => '&#777;','&#x30;' => '&#48;','&#x30a;' => '&#778;','&#x30f;' => '&#783;','&#x311;' => '&#785;','&#x31;' => '&#49;','&#x31b;' => '&#795;','&#x32;' => '&#50;','&#x33;' => '&#51;','&#x34;' => '&#52;','&#x35;' => '&#53;','&#x36;' => '&#54;','&#x37;' => '&#55;','&#x38;' => '&#56;','&#x391;' => '&#913;','&#x392;' => '&#914;','&#x393;' => '&#915;','&#x394;' => '&#916;','&#x395;' => '&#917;','&#x396;' => '&#918;','&#x397;' => '&#919;','&#x398;' => '&#920;','&#x399;' => '&#921;','&#x39;' => '&#57;','&#x39A;' => '&#922;','&#x39B;' => '&#923;','&#x39C;' => '&#924;','&#x39D;' => '&#925;','&#x39E;' => '&#926;','&#x39F;' => '&#927;','&#x39a;' => '&#922;','&#x39b;' => '&#923;','&#x39c;' => '&#924;','&#x39d;' => '&#925;','&#x39e;' => '&#926;','&#x39f;' => '&#927;','&#x3;' => '&#3;','&#x3A0;' => '&#928;','&#x3A1;' => '&#929;','&#x3A3;' => '&#931;','&#x3A4;' => '&#932;','&#x3A5;' => '&#933;','&#x3A6;' => '&#934;','&#x3A7;' => '&#935;','&#x3A8;' => '&#936;','&#x3A9;' => '&#937;','&#x3B1;' => '&#945;','&#x3B2;' => '&#946;','&#x3B3;' => '&#947;','&#x3B4;' => '&#948;','&#x3B5;' => '&#949;','&#x3B6;' => '&#950;','&#x3B7;' => '&#951;','&#x3B8;' => '&#952;','&#x3B9;' => '&#953;','&#x3BA;' => '&#954;','&#x3BB;' => '&#955;','&#x3BC;' => '&#956;','&#x3BD;' => '&#957;','&#x3BE;' => '&#958;','&#x3BF;' => '&#959;','&#x3C0;' => '&#960;','&#x3C1;' => '&#961;','&#x3C2;' => '&#962;','&#x3C3;' => '&#963;','&#x3C4;' => '&#964;','&#x3C5;' => '&#965;','&#x3C6;' => '&#966;','&#x3C7;' => '&#967;','&#x3C8;' => '&#968;','&#x3C9;' => '&#969;','&#x3C;' => '&#60;','&#x3D1;' => '&#977;','&#x3D2;' => '&#978;','&#x3D6;' => '&#982;','&#x3E;' => '&#62;','&#x3a0;' => '&#928;','&#x3a1;' => '&#929;','&#x3a3;' => '&#931;','&#x3a4;' => '&#932;','&#x3a5;' => '&#933;','&#x3a6;' => '&#934;','&#x3a7;' => '&#935;','&#x3a8;' => '&#936;','&#x3a9;' => '&#937;','&#x3a;' => '&#58;','&#x3b1;' => '&#945;','&#x3b2;' => '&#946;','&#x3b3;' => '&#947;','&#x3b4;' => '&#948;','&#x3b5;' => '&#949;','&#x3b6;' => '&#950;','&#x3b7;' => '&#951;','&#x3b8;' => '&#952;','&#x3b9;' => '&#953;','&#x3b;' => '&#59;','&#x3ba;' => '&#954;','&#x3bb;' => '&#955;','&#x3bc;' => '&#956;','&#x3bd;' => '&#957;','&#x3be;' => '&#958;','&#x3bf;' => '&#959;','&#x3c0;' => '&#960;','&#x3c1;' => '&#961;','&#x3c2;' => '&#962;','&#x3c3;' => '&#963;','&#x3c4;' => '&#964;','&#x3c5;' => '&#965;','&#x3c6;' => '&#966;','&#x3c7;' => '&#967;','&#x3c8;' => '&#968;','&#x3c9;' => '&#969;','&#x3c;' => '&#60;','&#x3d1;' => '&#977;','&#x3d2;' => '&#978;','&#x3d6;' => '&#982;','&#x3d;' => '&#61;','&#x3e;' => '&#62;','&#x3f;' => '&#63;','&#x401;' => '&#1025;','&#x402;' => '&#1026;','&#x403;' => '&#1027;','&#x404;' => '&#1028;','&#x405;' => '&#1029;','&#x406;' => '&#1030;','&#x407;' => '&#1031;','&#x408;' => '&#1032;','&#x409;' => '&#1033;','&#x40;' => '&#64;','&#x40a;' => '&#1034;','&#x40b;' => '&#1035;','&#x40c;' => '&#1036;','&#x40e;' => '&#1038;','&#x40f;' => '&#1039;','&#x410;' => '&#1040;','&#x411;' => '&#1041;','&#x412;' => '&#1042;','&#x413;' => '&#1043;','&#x414;' => '&#1044;','&#x415;' => '&#1045;','&#x416;' => '&#1046;','&#x417;' => '&#1047;','&#x418;' => '&#1048;','&#x419;' => '&#1049;','&#x41;' => '&#65;','&#x41a;' => '&#1050;','&#x41b;' => '&#1051;','&#x41c;' => '&#1052;','&#x41d;' => '&#1053;','&#x41e;' => '&#1054;','&#x41f;' => '&#1055;','&#x420;' => '&#1056;','&#x421;' => '&#1057;','&#x422;' => '&#1058;','&#x423;' => '&#1059;','&#x424;' => '&#1060;','&#x425;' => '&#1061;','&#x426;' => '&#1062;','&#x427;' => '&#1063;','&#x428;' => '&#1064;','&#x429;' => '&#1065;','&#x42;' => '&#66;','&#x42a;' => '&#1066;','&#x42b;' => '&#1067;','&#x42c;' => '&#1068;','&#x42d;' => '&#1069;','&#x42e;' => '&#1070;','&#x42f;' => '&#1071;','&#x430;' => '&#1072;','&#x431;' => '&#1073;','&#x432;' => '&#1074;','&#x433;' => '&#1075;','&#x434;' => '&#1076;','&#x435;' => '&#1077;','&#x436;' => '&#1078;','&#x437;' => '&#1079;','&#x438;' => '&#1080;','&#x439;' => '&#1081;','&#x43;' => '&#67;','&#x43a;' => '&#1082;','&#x43b;' => '&#1083;','&#x43c;' => '&#1084;','&#x43d;' => '&#1085;','&#x43e;' => '&#1086;','&#x43f;' => '&#1087;','&#x440;' => '&#1088;','&#x441;' => '&#1089;','&#x442;' => '&#1090;','&#x443;' => '&#1091;','&#x444;' => '&#1092;','&#x445;' => '&#1093;','&#x446;' => '&#1094;','&#x447;' => '&#1095;','&#x448;' => '&#1096;','&#x449;' => '&#1097;','&#x44;' => '&#68;','&#x44a;' => '&#1098;','&#x44b;' => '&#1099;','&#x44c;' => '&#1100;','&#x44d;' => '&#1101;','&#x44e;' => '&#1102;','&#x44f;' => '&#1103;','&#x451;' => '&#1105;','&#x452;' => '&#1106;','&#x453;' => '&#1107;','&#x454;' => '&#1108;','&#x455;' => '&#1109;','&#x456;' => '&#1110;','&#x457;' => '&#1111;','&#x458;' => '&#1112;','&#x459;' => '&#1113;','&#x45;' => '&#69;','&#x45a;' => '&#1114;','&#x45b;' => '&#1115;','&#x45c;' => '&#1116;','&#x45e;' => '&#1118;','&#x45f;' => '&#1119;','&#x46;' => '&#70;','&#x47;' => '&#71;','&#x483;' => '&#1155;','&#x48;' => '&#72;','&#x49;' => '&#73;','&#x4;' => '&#4;','&#x4a;' => '&#74;','&#x4b;' => '&#75;','&#x4c;' => '&#76;','&#x4d;' => '&#77;','&#x4e;' => '&#78;','&#x4f;' => '&#79;','&#x50;' => '&#80;','&#x51;' => '&#81;','&#x52;' => '&#82;','&#x53;' => '&#83;','&#x54;' => '&#84;','&#x55;' => '&#85;','&#x56;' => '&#86;','&#x57;' => '&#87;','&#x58;' => '&#88;','&#x59;' => '&#89;','&#x5;' => '&#5;','&#x5a;' => '&#90;','&#x5b;' => '&#91;','&#x5c;' => '&#92;','&#x5d;' => '&#93;','&#x5e;' => '&#94;','&#x5f;' => '&#95;','&#x60;' => '&#96;','&#x61;' => '&#97;','&#x62;' => '&#98;','&#x63;' => '&#99;','&#x64;' => '&#100;','&#x65;' => '&#101;','&#x66;' => '&#102;','&#x67;' => '&#103;','&#x68;' => '&#104;','&#x69;' => '&#105;','&#x6;' => '&#6;','&#x6a;' => '&#106;','&#x6b;' => '&#107;','&#x6c;' => '&#108;','&#x6d;' => '&#109;','&#x6e;' => '&#110;','&#x6f;' => '&#111;','&#x70;' => '&#112;','&#x71;' => '&#113;','&#x72;' => '&#114;','&#x73;' => '&#115;','&#x74;' => '&#116;','&#x75;' => '&#117;','&#x76;' => '&#118;','&#x77;' => '&#119;','&#x78;' => '&#120;','&#x79;' => '&#121;','&#x7;' => '&#7;','&#x7a;' => '&#122;','&#x7b;' => '&#123;','&#x7c;' => '&#124;','&#x7d;' => '&#125;','&#x7e;' => '&#126;','&#x7f;' => '&#127;','&#x80;' => '&#128;','&#x81;' => '&#129;','&#x82;' => '&#130;','&#x83;' => '&#131;','&#x84;' => '&#132;','&#x85;' => '&#133;','&#x86;' => '&#134;','&#x87;' => '&#135;','&#x88;' => '&#136;','&#x89;' => '&#137;','&#x8;' => '&#8;','&#x8a;' => '&#138;','&#x8b;' => '&#139;','&#x8c;' => '&#140;','&#x8d;' => '&#141;','&#x8e;' => '&#142;','&#x8f;' => '&#143;','&#x90;' => '&#144;','&#x91;' => '&#145;','&#x92;' => '&#146;','&#x93;' => '&#147;','&#x94;' => '&#148;','&#x95;' => '&#149;','&#x96;' => '&#150;','&#x97;' => '&#151;','&#x98;' => '&#152;','&#x99;' => '&#153;','&#x9;' => '&#9;','&#x9a;' => '&#154;','&#x9b;' => '&#155;','&#x9c;' => '&#156;','&#x9d;' => '&#157;','&#x9e;' => '&#158;','&#x9f;' => '&#159;','&#xA0;' => '&#160;','&#xA1;' => '&#161;','&#xA2;' => '&#162;','&#xA3;' => '&#163;','&#xA4;' => '&#164;','&#xA5;' => '&#165;','&#xA6;' => '&#166;','&#xA7;' => '&#167;','&#xA8;' => '&#168;','&#xA9;' => '&#169;','&#xAA;' => '&#170;','&#xAB;' => '&#171;','&#xAC;' => '&#172;','&#xAD;' => '&#173;','&#xAE;' => '&#174;','&#xAF;' => '&#175;','&#xB0;' => '&#176;','&#xB1;' => '&#177;','&#xB2;' => '&#178;','&#xB3;' => '&#179;','&#xB4;' => '&#180;','&#xB5;' => '&#181;','&#xB6;' => '&#182;','&#xB7;' => '&#183;','&#xB8;' => '&#184;','&#xB9;' => '&#185;','&#xBA;' => '&#186;','&#xBB;' => '&#187;','&#xBC;' => '&#188;','&#xBD;' => '&#189;','&#xBE;' => '&#190;','&#xBF;' => '&#191;','&#xC0;' => '&#192;','&#xC1;' => '&#193;','&#xC2;' => '&#194;','&#xC3;' => '&#195;','&#xC4;' => '&#196;','&#xC5;' => '&#197;','&#xC6;' => '&#198;','&#xC7;' => '&#199;','&#xC8;' => '&#200;','&#xC9;' => '&#201;','&#xCA;' => '&#202;','&#xCB;' => '&#203;','&#xCC;' => '&#204;','&#xCD;' => '&#205;','&#xCE;' => '&#206;','&#xCF;' => '&#207;','&#xD0;' => '&#208;','&#xD1;' => '&#209;','&#xD2;' => '&#210;','&#xD3;' => '&#211;','&#xD4;' => '&#212;','&#xD5;' => '&#213;','&#xD6;' => '&#214;','&#xD7;' => '&#215;','&#xD8;' => '&#216;','&#xD9;' => '&#217;','&#xDA;' => '&#218;','&#xDB;' => '&#219;','&#xDC;' => '&#220;','&#xDD;' => '&#221;','&#xDE;' => '&#222;','&#xDF;' => '&#223;','&#xE0;' => '&#224;','&#xE1;' => '&#225;','&#xE2;' => '&#226;','&#xE3;' => '&#227;','&#xE4;' => '&#228;','&#xE5;' => '&#229;','&#xE6;' => '&#230;','&#xE7;' => '&#231;','&#xE8;' => '&#232;','&#xE9;' => '&#233;','&#xEA;' => '&#234;','&#xEB;' => '&#235;','&#xEC;' => '&#236;','&#xED;' => '&#237;','&#xEE;' => '&#238;','&#xEF;' => '&#239;','&#xF0;' => '&#240;','&#xF1;' => '&#241;','&#xF2;' => '&#242;','&#xF3;' => '&#243;','&#xF4;' => '&#244;','&#xF5;' => '&#245;','&#xF6;' => '&#246;','&#xF7;' => '&#247;','&#xF8;' => '&#248;','&#xF9;' => '&#249;','&#xFA;' => '&#250;','&#xFB;' => '&#251;','&#xFC;' => '&#252;','&#xFD;' => '&#253;','&#xFE;' => '&#254;','&#xFF;' => '&#255;','&#xa0;' => '&#160;','&#xa1;' => '&#161;','&#xa2;' => '&#162;','&#xa3;' => '&#163;','&#xa4;' => '&#164;','&#xa5;' => '&#165;','&#xa6;' => '&#166;','&#xa7;' => '&#167;','&#xa8;' => '&#168;','&#xa9;' => '&#169;','&#xa;' => '&#10;','&#xaa;' => '&#170;','&#xab;' => '&#171;','&#xac;' => '&#172;','&#xad;' => '&#173;','&#xae;' => '&#174;','&#xaf;' => '&#175;','&#xb0;' => '&#176;','&#xb1;' => '&#177;','&#xb2;' => '&#178;','&#xb3;' => '&#179;','&#xb4;' => '&#180;','&#xb5;' => '&#181;','&#xb6;' => '&#182;','&#xb7;' => '&#183;','&#xb8;' => '&#184;','&#xb9;' => '&#185;','&#xb;' => '&#11;','&#xba;' => '&#186;','&#xbb;' => '&#187;','&#xbc;' => '&#188;','&#xbd;' => '&#189;','&#xbe;' => '&#190;','&#xbf;' => '&#191;','&#xc0;' => '&#192;','&#xc1;' => '&#193;','&#xc2;' => '&#194;','&#xc3;' => '&#195;','&#xc4;' => '&#196;','&#xc5;' => '&#197;','&#xc6;' => '&#198;','&#xc7;' => '&#199;','&#xc8;' => '&#200;','&#xc9;' => '&#201;','&#xc;' => '&#12;','&#xca;' => '&#202;','&#xcb;' => '&#203;','&#xcc;' => '&#204;','&#xcd;' => '&#205;','&#xce;' => '&#206;','&#xcf;' => '&#207;','&#xd0;' => '&#208;','&#xd1;' => '&#209;','&#xd2;' => '&#210;','&#xd3;' => '&#211;','&#xd4;' => '&#212;','&#xd5;' => '&#213;','&#xd6;' => '&#214;','&#xd7;' => '&#215;','&#xd8;' => '&#216;','&#xd9;' => '&#217;','&#xd;' => '&#13;','&#xda;' => '&#218;','&#xdb;' => '&#219;','&#xdc;' => '&#220;','&#xdd;' => '&#221;','&#xde;' => '&#222;','&#xdf;' => '&#223;','&#xe0;' => '&#224;','&#xe1;' => '&#225;','&#xe2;' => '&#226;','&#xe3;' => '&#227;','&#xe4;' => '&#228;','&#xe5;' => '&#229;','&#xe6;' => '&#230;','&#xe7;' => '&#231;','&#xe8;' => '&#232;','&#xe9;' => '&#233;','&#xe;' => '&#14;','&#xea;' => '&#234;','&#xeb;' => '&#235;','&#xec;' => '&#236;','&#xed;' => '&#237;','&#xee;' => '&#238;','&#xef;' => '&#239;','&#xf0;' => '&#240;','&#xf1;' => '&#241;','&#xf2;' => '&#242;','&#xf3;' => '&#243;','&#xf4;' => '&#244;','&#xf5;' => '&#245;','&#xf6;' => '&#246;','&#xf7;' => '&#247;','&#xf8;' => '&#248;','&#xf9;' => '&#249;','&#xf;' => '&#15;','&#xfa;' => '&#250;','&#xfb;' => '&#251;','&#xfc;' => '&#252;','&#xfd;' => '&#253;','&#xfe;' => '&#254;','&#xff;' => '&#255;'
  315.                     );
  316.  
  317.         foreach($a as $k => $v) {
  318.  
  319.             $s = str_replace($k, $v, $s);
  320.         }
  321.  
  322.         return $s;
  323.     }
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.     private function utf8_to_unicode($str, $strict = false) {
  341.  
  342.         $mState = 0;
  343.         $mUcs4 = 0;
  344.         $mBytes = 1;
  345.         $out = array();
  346.         $len = strlen($str);
  347.  
  348.         for ($i = 0; $i < $len; $i++) {
  349.  
  350.             $in = ord($str {$i});
  351.             if ($mState == 0) {
  352.  
  353.                 if (0 == (0x80 & ($in))) {
  354.  
  355.                     $out[] = $in;
  356.                     $mBytes = 1;
  357.                 } elseif (0xC0 == (0xE0 & ($in))) {
  358.  
  359.                         $mUcs4 = ($in);
  360.                         $mUcs4 = ($mUcs4 & 0x1F) << 6;
  361.                         $mState = 1;
  362.                         $mBytes = 2;
  363.                 } elseif (0xE0 == (0xF0 & ($in))) {
  364.  
  365.                         $mUcs4 = ($in);
  366.                         $mUcs4 = ($mUcs4 & 0x0F) << 12;
  367.                         $mState = 2;
  368.                         $mBytes = 3;
  369.                 } elseif (0xF0 == (0xF8 & ($in))) {
  370.  
  371.                         $mUcs4 = ($in);
  372.                         $mUcs4 = ($mUcs4 & 0x07) << 18;
  373.                         $mState = 3;
  374.                         $mBytes = 4;
  375.                 } elseif (0xF8 == (0xFC & ($in))) {
  376.  
  377.                         $mUcs4 = ($in);
  378.                         $mUcs4 = ($mUcs4 & 0x03) << 24;
  379.                         $mState = 4;
  380.                         $mBytes = 5;
  381.                 } elseif (0xFC == (0xFE & ($in))) {
  382.  
  383.                         $mUcs4 = ($in);
  384.                         $mUcs4 = ($mUcs4 & 1) << 30;
  385.                         $mState = 5;
  386.                         $mBytes = 6;
  387.  
  388.                 } elseif ($strict) {
  389.  
  390.                     trigger_error('utf8_to_unicode: Illegal sequence identifier ' . 'in UTF-8 at byte ' . $i, E_USER_WARNING);
  391.                     return false;
  392.                 }
  393.  
  394.             } else {
  395.  
  396.                 if (0x80 == (0xC0 & ($in))) {
  397.  
  398.                     $shift = ($mState - 1) * 6;
  399.                     $tmp = $in;
  400.                     $tmp = ($tmp & 0x0000003F) << $shift;
  401.                     $mUcs4 |= $tmp;
  402.                     if (0 ==--$mState) {
  403.  
  404.                         if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || ((3 == $mBytes) && ($mUcs4 < 0x0800)) || ((4 == $mBytes) && ($mUcs4 < 0x10000)) || (4 < $mBytes) || (($mUcs4 & 0xFFFFF800) == 0xD800) || ($mUcs4 > 0x10FFFF)) {
  405.  
  406.                             if ($strict) {
  407.  
  408.                                 trigger_error('utf8_to_unicode: Illegal sequence or codepoint ' . 'in UTF-8 at byte ' . $i, E_USER_WARNING);
  409.                                 return false;
  410.                             }
  411.                         }
  412.                         if (0xFEFF != $mUcs4) {
  413.  
  414.                             $out[] = $mUcs4;
  415.                         }
  416.                         $mState = 0;
  417.                         $mUcs4 = 0;
  418.                         $mBytes = 1;
  419.                     }
  420.                 } elseif ($strict) {
  421.  
  422.                     trigger_error('utf8_to_unicode: Incomplete multi-octet ' . '     sequence in UTF-8 at byte ' . $i, E_USER_WARNING);
  423.                     return false;
  424.                 }
  425.             }
  426.         }
  427.         return $out;
  428.     }
  429.  
  430.     public function utf8_to_html($str) {
  431.  
  432.         $ret = '';
  433.  
  434.         foreach ($this->utf8_to_unicode($str) as $cp) {
  435.  
  436.             if ($cp < 0x80)
  437.                 $ret .= chr($cp);
  438.             elseif ($cp < 0x100)
  439.                 $ret .= "&#$cp;";
  440.             else
  441.                 $ret .= '&#x' . dechex($cp) . ';';
  442.         }
  443.  
  444.         return $ret;
  445.     }
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455. }
  456.  
  457. /* if (!isset($Entities) || empty($Entities)) {
  458.  
  459.     $Entities = new Entities();
  460. } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement