반응형

이전 글에서 UTF-8 C1 Controls and Latin1 Supplement의 HTML Entities의 HTML Entities를 알아보았습니다.

이번 글에서는 HTML 4 Entity Names에 대해 알아보겠습니다.

 


 

1. HTML 4 Entity Names

https://www.w3schools.com/charsets/ref_html_entities_4.asp

 

HTML 4 Entities

HTML 4 Entity Names Complete HTML 4 Entity Reference All entities in the table below, will display correctly in all browsers, both in HTML4 and in HTML5 pages. For a complete HTML5 entity reference, please go to the next chapter. Char Entity Dec Hex Descri

www.w3schools.com

 

 

2. char -> Entities 로 변환하는 코드

replaceAll("&", "&");
replaceAll("<", "&lt;");
replaceAll(">", "&gt;");
replaceAll(" ", "&nbsp;");
replaceAll("¡", "&iexcl;");
replaceAll("¢", "&cent;");
replaceAll("£", "&pound;");
replaceAll("¤", "&curren;");
replaceAll("¥", "&yen;");
replaceAll("¦", "&brvbar;");
replaceAll("§", "&sect;");
replaceAll("¨", "&uml;");
replaceAll("©", "&copy;");
replaceAll("ª", "&ordf;");
replaceAll("«", "&laquo;");
replaceAll("¬", "&not;");
replaceAll("­", "&shy;");
replaceAll("®", "&reg;");
replaceAll("¯", "&macr;");
replaceAll("°", "&deg;");
replaceAll("±", "&plusmn;");
replaceAll("²", "&sup2;");
replaceAll("³", "&sup3;");
replaceAll("´", "&acute;");
replaceAll("µ", "&micro;");
replaceAll("¶", "&para;");
replaceAll("·", "&middot;");
replaceAll("¸", "&cedil;");
replaceAll("¹", "&sup1;");
replaceAll("º", "&ordm;");
replaceAll("»", "&raquo;");
replaceAll("¼", "&frac14;");
replaceAll("½", "&frac12;");
replaceAll("¾", "&frac34;");
replaceAll("¿", "&iquest;");
replaceAll("À", "&Agrave;");
replaceAll("Á", "&Aacute;");
replaceAll("Â", "&Acirc;");
replaceAll("Ã", "&Atilde;");
replaceAll("Ä", "&Auml;");
replaceAll("Å", "&Aring;");
replaceAll("Æ", "&AElig;");
replaceAll("Ç", "&Ccedil;");
replaceAll("È", "&Egrave;");
replaceAll("É", "&Eacute;");
replaceAll("Ê", "&Ecirc;");
replaceAll("Ë", "&Euml;");
replaceAll("Ì", "&Igrave;");
replaceAll("Í", "&Iacute;");
replaceAll("Î", "&Icirc;");
replaceAll("Ï", "&Iuml;");
replaceAll("Ð", "&ETH;");
replaceAll("Ñ", "&Ntilde;");
replaceAll("Ò", "&Ograve;");
replaceAll("Ó", "&Oacute;");
replaceAll("Ô", "&Ocirc;");
replaceAll("Õ", "&Otilde;");
replaceAll("Ö", "&Ouml;");
replaceAll("×", "&times;");
replaceAll("Ø", "&Oslash;");
replaceAll("Ù", "&Ugrave;");
replaceAll("Ú", "&Uacute;");
replaceAll("Û", "&Ucirc;");
replaceAll("Ü", "&Uuml;");
replaceAll("Ý", "&Yacute;");
replaceAll("Þ", "&THORN;");
replaceAll("ß", "&szlig;");
replaceAll("à", "&agrave;");
replaceAll("á", "&aacute;");
replaceAll("â", "&acirc;");
replaceAll("ã", "&atilde;");
replaceAll("ä", "&auml;");
replaceAll("å", "&aring;");
replaceAll("æ", "&aelig;");
replaceAll("ç", "&ccedil;");
replaceAll("è", "&egrave;");
replaceAll("é", "&eacute;");
replaceAll("ê", "&ecirc;");
replaceAll("ë", "&euml;");
replaceAll("ì", "&igrave;");
replaceAll("í", "&iacute;");
replaceAll("î", "&icirc;");
replaceAll("ï", "&iuml;");
replaceAll("ð", "&eth;");
replaceAll("ñ", "&ntilde;");
replaceAll("ò", "&ograve;");
replaceAll("ó", "&oacute;");
replaceAll("ô", "&ocirc;");
replaceAll("õ", "&otilde;");
replaceAll("ö", "&ouml;");
replaceAll("÷", "&divide;");
replaceAll("ø", "&oslash;");
replaceAll("ù", "&ugrave;");
replaceAll("ú", "&uacute;");
replaceAll("û", "&ucirc;");
replaceAll("ü", "&uuml;");
replaceAll("ý", "&yacute;");
replaceAll("þ", "&thorn;");
replaceAll("ÿ", "&yuml;");
replaceAll("ƒ", "&fnof;");
replaceAll("Α", "&Alpha;");
replaceAll("Β", "&Beta;");
replaceAll("Γ", "&Gamma;");
replaceAll("Δ", "&Delta;");
replaceAll("Ε", "&Epsilon;");
replaceAll("Ζ", "&Zeta;");
replaceAll("Η", "&Eta;");
replaceAll("Θ", "&Theta;");
replaceAll("Ι", "&Iota;");
replaceAll("Κ", "&Kappa;");
replaceAll("Λ", "&Lambda;");
replaceAll("Μ", "&Mu;");
replaceAll("Ν", "&Nu;");
replaceAll("Ξ", "&Xi;");
replaceAll("Ο", "&Omicron;");
replaceAll("Π", "&Pi;");
replaceAll("Ρ", "&Rho;");
replaceAll("Σ", "&Sigma;");
replaceAll("Τ", "&Tau;");
replaceAll("Υ", "&Upsilon;");
replaceAll("Φ", "&Phi;");
replaceAll("Χ", "&Chi;");
replaceAll("Ψ", "&Psi;");
replaceAll("Ω", "&Omega;");
replaceAll("α", "&alpha;");
replaceAll("β", "&beta;");
replaceAll("γ", "&gamma;");
replaceAll("δ", "&delta;");
replaceAll("ε", "&epsilon;");
replaceAll("ζ", "&zeta;");
replaceAll("η", "&eta;");
replaceAll("θ", "&theta;");
replaceAll("ι", "&iota;");
replaceAll("κ", "&kappa;");
replaceAll("λ", "&lambda;");
replaceAll("μ", "&mu;");
replaceAll("ν", "&nu;");
replaceAll("ξ", "&xi;");
replaceAll("ο", "&omicron;");
replaceAll("π", "&pi;");
replaceAll("ρ", "&rho;");
replaceAll("ς", "&sigmaf;");
replaceAll("σ", "&sigma;");
replaceAll("τ", "&tau;");
replaceAll("υ", "&upsilon;");
replaceAll("φ", "&phi;");
replaceAll("χ", "&chi;");
replaceAll("ψ", "&psi;");
replaceAll("ω", "&omega;");
replaceAll("ϑ", "&thetasym;");
replaceAll("ϒ", "&upsih;");
replaceAll("ϖ", "&piv;");

 

 

3. Entities -> char 로 변환하는 코드

replaceAll("&amp;", "&");
replaceAll("&lt;", "<");
replaceAll("&gt;", ">");
replaceAll("&nbsp;", " ");
replaceAll("&iexcl;", "¡");
replaceAll("&cent;", "¢");
replaceAll("&pound;", "£");
replaceAll("&curren;", "¤");
replaceAll("&yen;", "¥");
replaceAll("&brvbar;", "¦");
replaceAll("&sect;", "§");
replaceAll("&uml;", "¨");
replaceAll("&copy;", "©");
replaceAll("&ordf;", "ª");
replaceAll("&laquo;", "«");
replaceAll("&not;", "¬");
replaceAll("&shy;", "­");
replaceAll("&reg;", "®");
replaceAll("&macr;", "¯");
replaceAll("&deg;", "°");
replaceAll("&plusmn;", "±");
replaceAll("&sup2;", "²");
replaceAll("&sup3;", "³");
replaceAll("&acute;", "´");
replaceAll("&micro;", "µ");
replaceAll("&para;", "¶");
replaceAll("&middot;", "·");
replaceAll("&cedil;", "¸");
replaceAll("&sup1;", "¹");
replaceAll("&ordm;", "º");
replaceAll("&raquo;", "»");
replaceAll("&frac14;", "¼");
replaceAll("&frac12;", "½");
replaceAll("&frac34;", "¾");
replaceAll("&iquest;", "¿");
replaceAll("&Agrave;", "À");
replaceAll("&Aacute;", "Á");
replaceAll("&Acirc;", "Â");
replaceAll("&Atilde;", "Ã");
replaceAll("&Auml;", "Ä");
replaceAll("&Aring;", "Å");
replaceAll("&AElig;", "Æ");
replaceAll("&Ccedil;", "Ç");
replaceAll("&Egrave;", "È");
replaceAll("&Eacute;", "É");
replaceAll("&Ecirc;", "Ê");
replaceAll("&Euml;", "Ë");
replaceAll("&Igrave;", "Ì");
replaceAll("&Iacute;", "Í");
replaceAll("&Icirc;", "Î");
replaceAll("&Iuml;", "Ï");
replaceAll("&ETH;", "Ð");
replaceAll("&Ntilde;", "Ñ");
replaceAll("&Ograve;", "Ò");
replaceAll("&Oacute;", "Ó");
replaceAll("&Ocirc;", "Ô");
replaceAll("&Otilde;", "Õ");
replaceAll("&Ouml;", "Ö");
replaceAll("&times;", "×");
replaceAll("&Oslash;", "Ø");
replaceAll("&Ugrave;", "Ù");
replaceAll("&Uacute;", "Ú");
replaceAll("&Ucirc;", "Û");
replaceAll("&Uuml;", "Ü");
replaceAll("&Yacute;", "Ý");
replaceAll("&THORN;", "Þ");
replaceAll("&szlig;", "ß");
replaceAll("&agrave;", "à");
replaceAll("&aacute;", "á");
replaceAll("&acirc;", "â");
replaceAll("&atilde;", "ã");
replaceAll("&auml;", "ä");
replaceAll("&aring;", "å");
replaceAll("&aelig;", "æ");
replaceAll("&ccedil;", "ç");
replaceAll("&egrave;", "è");
replaceAll("&eacute;", "é");
replaceAll("&ecirc;", "ê");
replaceAll("&euml;", "ë");
replaceAll("&igrave;", "ì");
replaceAll("&iacute;", "í");
replaceAll("&icirc;", "î");
replaceAll("&iuml;", "ï");
replaceAll("&eth;", "ð");
replaceAll("&ntilde;", "ñ");
replaceAll("&ograve;", "ò");
replaceAll("&oacute;", "ó");
replaceAll("&ocirc;", "ô");
replaceAll("&otilde;", "õ");
replaceAll("&ouml;", "ö");
replaceAll("&divide;", "÷");
replaceAll("&oslash;", "ø");
replaceAll("&ugrave;", "ù");
replaceAll("&uacute;", "ú");
replaceAll("&ucirc;", "û");
replaceAll("&uuml;", "ü");
replaceAll("&yacute;", "ý");
replaceAll("&thorn;", "þ");
replaceAll("&yuml;", "ÿ");
replaceAll("&fnof;", "ƒ");
replaceAll("&Alpha;", "Α");
replaceAll("&Beta;", "Β");
replaceAll("&Gamma;", "Γ");
replaceAll("&Delta;", "Δ");
replaceAll("&Epsilon;", "Ε");
replaceAll("&Zeta;", "Ζ");
replaceAll("&Eta;", "Η");
replaceAll("&Theta;", "Θ");
replaceAll("&Iota;", "Ι");
replaceAll("&Kappa;", "Κ");
replaceAll("&Lambda;", "Λ");
replaceAll("&Mu;", "Μ");
replaceAll("&Nu;", "Ν");
replaceAll("&Xi;", "Ξ");
replaceAll("&Omicron;", "Ο");
replaceAll("&Pi;", "Π");
replaceAll("&Rho;", "Ρ");
replaceAll("&Sigma;", "Σ");
replaceAll("&Tau;", "Τ");
replaceAll("&Upsilon;", "Υ");
replaceAll("&Phi;", "Φ");
replaceAll("&Chi;", "Χ");
replaceAll("&Psi;", "Ψ");
replaceAll("&Omega;", "Ω");
replaceAll("&alpha;", "α");
replaceAll("&beta;", "β");
replaceAll("&gamma;", "γ");
replaceAll("&delta;", "δ");
replaceAll("&epsilon;", "ε");
replaceAll("&zeta;", "ζ");
replaceAll("&eta;", "η");
replaceAll("&theta;", "θ");
replaceAll("&iota;", "ι");
replaceAll("&kappa;", "κ");
replaceAll("&lambda;", "λ");
replaceAll("&mu;", "μ");
replaceAll("&nu;", "ν");
replaceAll("&xi;", "ξ");
replaceAll("&omicron;", "ο");
replaceAll("&pi;", "π");
replaceAll("&rho;", "ρ");
replaceAll("&sigmaf;", "ς");
replaceAll("&sigma;", "σ");
replaceAll("&tau;", "τ");
replaceAll("&upsilon;", "υ");
replaceAll("&phi;", "φ");
replaceAll("&chi;", "χ");
replaceAll("&psi;", "ψ");
replaceAll("&omega;", "ω");
replaceAll("&thetasym;", "ϑ");
replaceAll("&upsih;", "ϒ");
replaceAll("&piv;", "ϖ");

 

 

 

이상으로 HTML Entities를 변환하는 코드를 알아보았습니다.


 

반응형