PHP get_html_translation_table() Function


The get_html_translation_table() function is used to return the conversion table used by htmlspecialchars() and htmlentities(). These functions are used to encode special characters in HTML.

Syntax
get_html_translation_table(function,flags,character-set)
Parameters
Parameter Description
function (Optional) Specifies the translation table to return.
  • HTML_SPECIALCHARS - Default. Converts some characters that require URL encoding to display properly on an HTML page.
  • HTML_ENTITIES - Converts all characters that require URL encoding to display properly on an HTML page.
flags (Optional) Specify which citations should be included in the table and what types of documents should be included in the table.
  • ENT_COMPAT - Default. Table contains entities with double quotes instead of single quotes.
  • ENT_QUOTES - The table contains double quote and single quote entities.
  • ENT_NOQUOTES - Table does not contain double quote and single quote entities.
character-set (Optional) A string indicating which character set to use.
  • UTF-8 - Default. ASCII compatible multi-byte 8-bit Unicode
  • ISO-8859-1 - Western Europe
  • ISO-8859-15 - Western European (adds euro symbol + French and Finnish characters not in ISO-8859-1)
  • cp866 - DOS-specific Cyrillic character set
  • cp1251 - Windows-specific Cyrillic character set
  • cp1252 - Windows-specific Western European character set
  • KOI8-R - Russian
  • BIG5 - Traditional Chinese, primarily used in Taiwan
  • GB2312 - Simplified Chinese, National Standard Character Set
  • BIG5-HKSCS - Big5 with Hong Kong extensions
  • Shift_JIS - Japanese
  • EUC-JP - Japanese
  • MacRoman - Character set used by Mac OS
Display HTML_SPECIALCHARS
Example
<?php
print_r (get_html_translation_table(HTML_SPECIALCHARS));
?>

Output

Array ( ["] => " [&] => & [<] => < [>] => > )
Display HTML_ENTITIES
Example
<?php
print_r (get_html_translation_table(HTML_ENTITIES));
?>

Output

Array ( ["] => " [&] => & [<] => < [>] => > [ ] =>   [¡] => ¡ [¢] => ¢ [£] => £ [¤] => ¤ [Â¥] => ¥ [¦] => ¦ [§] => § [¨] => ¨ [©] => © [ª] => ª [«] => « [¬] => ¬ [­] => ­ [®] => ® [¯] => ¯ [°] => ° [±] => ± [²] => ² [³] => ³ [´] => ´ [µ] => µ [¶] => ¶ [·] => · [¸] => ¸ [¹] => ¹ [º] => º [»] => » [¼] => ¼ [½] => ½ [¾] => ¾ [¿] => ¿ [À] => À [Á] => Á [Â] =>  [Ã] => à [Ä] => Ä [Ã…] => Å [Æ] => Æ [Ç] => Ç [È] => È [É] => É [Ê] => Ê [Ë] => Ë [ÃŒ] => Ì [Í] => Í [ÃŽ] => Î [Ï] => Ï [Ð] => Ð [Ñ] => Ñ [Ã’] => Ò [Ó] => Ó [Ô] => Ô [Õ] => Õ [Ö] => Ö [×] => × [Ø] => Ø [Ù] => Ù [Ú] => Ú [Û] => Û [Ãœ] => Ü [Ý] => Ý [Þ] => Þ [ß] => ß [à ] => à [á] => á [â] => â [ã] => ã [ä] => ä [Ã¥] => å [æ] => æ [ç] => ç [è] => è [é] => é [ê] => ê [ë] => ë [ì] => ì [í] => í [î] => î [ï] => ï [ð] => ð [ñ] => ñ [ò] => ò [ó] => ó [ô] => ô [õ] => õ [ö] => ö [÷] => ÷ [ø] => ø [ù] => ù [ú] => ú [û] => û [ü] => ü [ý] => ý [þ] => þ [ÿ] => ÿ [Å’] => Œ [Å“] => œ [Å ] => Š [Å¡] => š [Ÿ] => Ÿ [Æ’] => ƒ [ˆ] => ˆ [Ëœ] => ˜ [Α] => Α [Î’] => Β [Γ] => Γ [Δ] => Δ [Ε] => Ε [Ζ] => Ζ [Η] => Η [Θ] => Θ [Ι] => Ι [Κ] => Κ [Λ] => Λ [Îœ] => Μ [Ν] => Ν [Ξ] => Ξ [Ο] => Ο [Î ] => Π [Ρ] => Ρ [Σ] => Σ [Τ] => Τ [Î¥] => Υ [Φ] => Φ [Χ] => Χ [Ψ] => Ψ [Ω] => Ω [α] => α [β] => β [γ] => γ [δ] => δ [ε] => ε [ζ] => ζ [η] => η [θ] => θ [ι] => ι [κ] => κ [λ] => λ [μ] => μ [ν] => ν [ξ] => ξ [ο] => ο [Ï€] => π [ρ] => ρ [Ï‚] => ς [σ] => σ [Ï„] => τ [Ï…] => υ [φ] => φ [χ] => χ [ψ] => ψ [ω] => ω [Ï‘] => ϑ [Ï’] => ϒ [Ï–] => ϖ [ ] =>   [ ] =>   [ ] =>   [‌] => ‌ [‍] => ‍ [‎] => ‎ [‏] => ‏ [–] => – [—] => — [‘] => ‘ [’] => ’ [‚] => ‚ [“] => “ [”] => ” [„] => „ [†] => † [‡] => ‡ [•] => • […] => … [‰] => ‰ [′] => ′ [″] => ″ [‹] => ‹ [›] => › [‾] => ‾ [⁄] => ⁄ [€] => € [â„‘] => ℑ [℘] => ℘ [â„œ] => ℜ [â„¢] => ™ [ℵ] => ℵ [←] => ← [↑] => ↑ [→] => → [↓] => ↓ [↔] => ↔ [↵] => ↵ [⇐] => ⇐ [⇑] => ⇑ [⇒] => ⇒ [⇓] => ⇓ [⇔] => ⇔ [∀] => ∀ [∂] => ∂ [∃] => ∃ [∅] => ∅ [∇] => ∇ [∈] => ∈ [∉] => ∉ [∋] => ∋ [∏] => ∏ [∑] => ∑ [−] => − [∗] => ∗ [√] => √ [∝] => ∝ [∞] => ∞ [∠] => ∠ [∧] => ∧ [∨] => ∨ [∩] => ∩ [∪] => ∪ [∫] => ∫ [∴] => ∴ [∼] => ∼ [≅] => ≅ [≈] => ≈ [≠] => ≠ [≡] => ≡ [≤] => ≤ [≥] => ≥ [⊂] => ⊂ [⊃] => ⊃ [⊄] => ⊄ [⊆] => ⊆ [⊇] => ⊇ [⊕] => ⊕ [⊗] => ⊗ [⊥] => ⊥ [â‹…] => ⋅ [⌈] => ⌈ [⌉] => ⌉ [⌊] => ⌊ [⌋] => ⌋ [〈] => ⟨ [〉] => ⟩ [â—Š] => ◊ [â™ ] => ♠ [♣] => ♣ [♥] => ♥ [♦] => ♦ )

Prev Next