alphanormalize_php – tests

 Olivier Pirsonolivier_pirson_opi@yahoo.fr – v.03.00.02 – October 19, 2016
PHP version 7.0.33-0+deb9u3
$s
Il était une fois… des caractères "bizarroïdes" (avec accent, cédille et compagnie, ou α, β, etc.)
accompagnés ou pas de formatage (X)HTML.
Je cherchais à m’en débarrasser !
Ceci est ma solution.
mb_str_accentalpha_to_alpha($s)
Il etait une fois… des caracteres "bizarroides" (avec accent, cedille et compagnie, ou α, β, etc.)
accompagnes ou pas de formatage (X)HTML.
Je cherchais a m’en debarrasser !
Ceci est ma solution.
mb_str_greek_to_alpha($s)
Il était une fois… des caractères "bizarroïdes" (avec accent, cédille et compagnie, ou a, v, etc.)
accompagnés ou pas de formatage (X)HTML.
Je cherchais à m’en débarrasser !
Ceci est ma solution.
htmlspecialchars($s) <pre>Il était une fois&hellip; des <em>caractères</em> "bizarroïdes" (avec accent, cédille et compagnie, ou α, β, etc.) accompagnés ou pas de formatage <em>(X)HTML</em>. Je cherchais à m&rsquo;en débarrasser&nbsp;! Ceci est ma solution.</pre>
mb_str_alphanormalize($s) _pre_Il_etait_une_fois_hellip_des_em_caracteres_em_bizarroides_avec_accent_cedille_et_compagnie_ou_a_v_etc_accompagnes_ou_pas_de_formatage_em_X_HTML_em_Je_cherchais_a_m_rsquo_en_debarrasser_nbsp_Ceci_est_ma_solution_pre_
mb_str_alphanormalize($s, true) Il_etait_une_fois_hellip_des_caracteres_bizarroides_avec_accent_cedille_et_compagnie_ou_a_v_etc_accompagnes_ou_pas_de_formatage_X_HTML_Je_cherchais_a_m_rsquo_en_debarrasser_nbsp_Ceci_est_ma_solution_
$ACCENTALPHA_TO_ALPHA[]:
$c À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý ß à á â ã ä å æ ç è é ê ë ì í î ï ñ ò ó ô õ ö ø ù ú û ü ý ÿ Œ œ Š š Ÿ
$ACCENTALPHA_TO_ALPHA[$c] A A A A A A AE C E E E E I I I I N O O O O O O U U U U Y sz a a a a a a ae c e e e e i i i i n o o o o o o u u u u y y OE oe S s Y
$GREEK_TO_ALPHA[] (Adopts the standard ONU/ELOT: see. Memento grecs):
$c Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς σ τ υ φ χ ψ ω ϑ ϒ ϖ
$GREEK_TO_ALPHA[$c] A V G D E Z I TH I K L M N X O P R S T Y F CH PS O a v g d e z i th i k l m n x o p r s s t y f ch ps o th y p
Associative table returned by the PHP function get_html_translation_table(HTML_SPECIALCHARS):
htmlspecialchars($c) " & < >
htmlspecialchars(get_html_translation_table(HTML_SPECIALCHARS)[$c]) &quot; &amp; &lt; &gt;
mb_str_alphanormalize($c) _ _ _ _
Associative table returned by the PHP function get_html_translation_table(HTML_ENTITIES):
htmlspecialchars(utf8_encode($c)) " & < >   ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ Œ œ Š š Ÿ ƒ ˆ ˜ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς σ τ υ φ χ ψ ω ϑ ϒ ϖ
htmlspecialchars(get_html_translation_table(HTML_ENTITIES)[$c]) &quot; &amp; &lt; &gt; &nbsp; &iexcl; &cent; &pound; &curren; &yen; &brvbar; &sect; &uml; &copy; &ordf; &laquo; &not; &shy; &reg; &macr; &deg; &plusmn; &sup2; &sup3; &acute; &micro; &para; &middot; &cedil; &sup1; &ordm; &raquo; &frac14; &frac12; &frac34; &iquest; &Agrave; &Aacute; &Acirc; &Atilde; &Auml; &Aring; &AElig; &Ccedil; &Egrave; &Eacute; &Ecirc; &Euml; &Igrave; &Iacute; &Icirc; &Iuml; &ETH; &Ntilde; &Ograve; &Oacute; &Ocirc; &Otilde; &Ouml; &times; &Oslash; &Ugrave; &Uacute; &Ucirc; &Uuml; &Yacute; &THORN; &szlig; &agrave; &aacute; &acirc; &atilde; &auml; &aring; &aelig; &ccedil; &egrave; &eacute; &ecirc; &euml; &igrave; &iacute; &icirc; &iuml; &eth; &ntilde; &ograve; &oacute; &ocirc; &otilde; &ouml; &divide; &oslash; &ugrave; &uacute; &ucirc; &uuml; &yacute; &thorn; &yuml; &OElig; &oelig; &Scaron; &scaron; &Yuml; &fnof; &circ; &tilde; &Alpha; &Beta; &Gamma; &Delta; &Epsilon; &Zeta; &Eta; &Theta; &Iota; &Kappa; &Lambda; &Mu; &Nu; &Xi; &Omicron; &Pi; &Rho; &Sigma; &Tau; &Upsilon; &Phi; &Chi; &Psi; &Omega; &alpha; &beta; &gamma; &delta; &epsilon; &zeta; &eta; &theta; &iota; &kappa; &lambda; &mu; &nu; &xi; &omicron; &pi; &rho; &sigmaf; &sigma; &tau; &upsilon; &phi; &chi; &psi; &omega; &thetasym; &upsih; &piv; &ensp; &emsp; &thinsp; &zwnj; &zwj; &lrm; &rlm; &ndash; &mdash; &lsquo; &rsquo; &sbquo; &ldquo; &rdquo; &bdquo; &dagger; &Dagger; &bull; &hellip; &permil; &prime; &Prime; &lsaquo; &rsaquo; &oline; &frasl; &euro; &image; &weierp; &real; &trade; &alefsym; &larr; &uarr; &rarr; &darr; &harr; &crarr; &lArr; &uArr; &rArr; &dArr; &hArr; &forall; &part; &exist; &empty; &nabla; &isin; &notin; &ni; &prod; &sum; &minus; &lowast; &radic; &prop; &infin; &ang; &and; &or; &cap; &cup; &int; &there4; &sim; &cong; &asymp; &ne; &equiv; &le; &ge; &sub; &sup; &nsub; &sube; &supe; &oplus; &otimes; &perp; &sdot; &lceil; &rceil; &lfloor; &rfloor; &lang; &rang; &loz; &spades; &clubs; &hearts; &diams;
mb_str_alphanormalize(utf8_encode($c)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ A A A A A A AE C E E E E I I I I _ N O O O O O _ O U U U U Y _ sz a a a a a a ae c e e e e i i i i _ n o o o o o _ o u u u u y _ y OE oe S s Y _ _ _ A V G D E Z I TH I K L M N X O P R S T Y F CH PS O a v g d e z i th i k l m n x o p r s s t y f ch ps o th y p _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
(252 éléments)
Three associative tables (copied from Python dictionary of module html.entities):
$HTML_ENTITIES_ENTITYDEFS[]:
$k AElig Aacute Acirc Agrave Alpha Aring Atilde Auml Beta Ccedil Chi Dagger Delta ETH Eacute Ecirc Egrave Epsilon Eta Euml Gamma Iacute Icirc Igrave Iota Iuml Kappa Lambda Mu Ntilde Nu OElig Oacute Ocirc Ograve Omega Omicron Oslash Otilde Ouml Phi Pi Prime Psi Rho Scaron Sigma THORN Tau Theta Uacute Ucirc Ugrave Upsilon Uuml Xi Yacute Yuml Zeta aacute acirc acute aelig agrave alefsym alpha amp and ang aring asymp atilde auml bdquo beta brvbar bull cap ccedil cedil cent chi circ clubs cong copy crarr cup curren dArr dagger darr deg delta diams divide eacute ecirc egrave empty emsp ensp epsilon equiv eta eth euml euro exist fnof forall frac12 frac14 frac34 frasl gamma ge gt hArr harr hearts hellip iacute icirc iexcl igrave image infin int iota iquest isin iuml kappa lArr lambda lang laquo larr lceil ldquo le lfloor lowast loz lrm lsaquo lsquo lt macr mdash micro middot minus mu nabla nbsp ndash ne ni not notin nsub ntilde nu oacute ocirc oelig ograve oline omega omicron oplus or ordf ordm oslash otilde otimes ouml para part permil perp phi pi piv plusmn pound prime prod prop psi quot rArr radic rang raquo rarr rceil rdquo real reg rfloor rho rlm rsaquo rsquo sbquo scaron sdot sect shy sigma sigmaf sim spades sub sube sum sup sup1 sup2 sup3 supe szlig tau there4 theta thetasym thinsp thorn tilde times trade uArr uacute uarr ucirc ugrave uml upsih upsilon uuml weierp xi yacute yen yuml zeta zwj zwnj
htmlspecialchars($HTML_ENTITIES_ENTITYDEFS[$k]) Æ Á  À Α Å Ã Ä Β Ç Χ Δ Ð É Ê È Ε Η Ë Γ Í Î Ì Ι Ï Κ Λ Μ Ñ Ν Œ Ó Ô Ò Ω Ο Ø Õ Ö Φ Π Ψ Ρ Š Σ Þ Τ Θ Ú Û Ù Υ Ü Ξ Ý Ÿ Ζ á â ´ æ à α & å ã ä β ¦ ç ¸ ¢ χ ˆ © ¤ ° δ ÷ é ê è ε η ð ë ƒ ½ ¼ ¾ γ > í î ¡ ì ι ¿ ï κ λ « < ¯ µ · μ   ¬ ñ ν ó ô œ ò ω ο ª º ø õ ö φ π ϖ ± £ ψ " » ® ρ š § ­ σ ς ¹ ² ³ ß τ θ ϑ þ ˜ × ú û ù ¨ ϒ υ ü ξ ý ¥ ÿ ζ
(In green the 0 items over 252 which are not in get_html_translation_table(HTML_ENTITIES). Previous PHP 5.4, all HTML entities are not supported!)
$HTML_ENTITIES_NAME2CODEPOINT[]:
$k AElig Aacute Acirc Agrave Alpha Aring Atilde Auml Beta Ccedil Chi Dagger Delta ETH Eacute Ecirc Egrave Epsilon Eta Euml Gamma Iacute Icirc Igrave Iota Iuml Kappa Lambda Mu Ntilde Nu OElig Oacute Ocirc Ograve Omega Omicron Oslash Otilde Ouml Phi Pi Prime Psi Rho Scaron Sigma THORN Tau Theta Uacute Ucirc Ugrave Upsilon Uuml Xi Yacute Yuml Zeta aacute acirc acute aelig agrave alefsym alpha amp and ang aring asymp atilde auml bdquo beta brvbar bull cap ccedil cedil cent chi circ clubs cong copy crarr cup curren dArr dagger darr deg delta diams divide eacute ecirc egrave empty emsp ensp epsilon equiv eta eth euml euro exist fnof forall frac12 frac14 frac34 frasl gamma ge gt hArr harr hearts hellip iacute icirc iexcl igrave image infin int iota iquest isin iuml kappa lArr lambda lang laquo larr lceil ldquo le lfloor lowast loz lrm lsaquo lsquo lt macr mdash micro middot minus mu nabla nbsp ndash ne ni not notin nsub ntilde nu oacute ocirc oelig ograve oline omega omicron oplus or ordf ordm oslash otilde otimes ouml para part permil perp phi pi piv plusmn pound prime prod prop psi quot rArr radic rang raquo rarr rceil rdquo real reg rfloor rho rlm rsaquo rsquo sbquo scaron sdot sect shy sigma sigmaf sim spades sub sube sum sup sup1 sup2 sup3 supe szlig tau there4 theta thetasym thinsp thorn tilde times trade uArr uacute uarr ucirc ugrave uml upsih upsilon uuml weierp xi yacute yen yuml zeta zwj zwnj
$HTML_ENTITIES_NAME2CODEPOINT[$k] 198 193 194 192 913 197 195 196 914 199 935 8225 916 208 201 202 200 917 919 203 915 205 206 204 921 207 922 923 924 209 925 338 211 212 210 937 927 216 213 214 934 928 8243 936 929 352 931 222 932 920 218 219 217 933 220 926 221 376 918 225 226 180 230 224 8501 945 38 8743 8736 229 8776 227 228 8222 946 166 8226 8745 231 184 162 967 710 9827 8773 169 8629 8746 164 8659 8224 8595 176 948 9830 247 233 234 232 8709 8195 8194 949 8801 951 240 235 8364 8707 402 8704 189 188 190 8260 947 8805 62 8660 8596 9829 8230 237 238 161 236 8465 8734 8747 953 191 8712 239 954 8656 955 9001 171 8592 8968 8220 8804 8970 8727 9674 8206 8249 8216 60 175 8212 181 183 8722 956 8711 160 8211 8800 8715 172 8713 8836 241 957 243 244 339 242 8254 969 959 8853 8744 170 186 248 245 8855 246 182 8706 8240 8869 966 960 982 177 163 8242 8719 8733 968 34 8658 8730 9002 187 8594 8969 8221 8476 174 8971 961 8207 8250 8217 8218 353 8901 167 173 963 962 8764 9824 8834 8838 8721 8835 185 178 179 8839 223 964 8756 952 977 8201 254 732 215 8482 8657 250 8593 251 249 168 978 965 252 8472 958 253 165 255 950 8205 8204
$HTML_ENTITIES_CODEPOINT2NAME[]:
$k 34 38 60 62 160 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 9001 9002 9674 9824 9827 9829 9830
$HTML_ENTITIES_CODEPOINT2NAME[$k] quot amp lt gt nbsp iexcl cent pound curren yen brvbar sect uml copy ordf laquo not shy reg macr deg plusmn sup2 sup3 acute micro para middot cedil sup1 ordm raquo frac14 frac12 frac34 iquest Agrave Aacute Acirc Atilde Auml Aring AElig Ccedil Egrave Eacute Ecirc Euml Igrave Iacute Icirc Iuml ETH Ntilde Ograve Oacute Ocirc Otilde Ouml times Oslash Ugrave Uacute Ucirc Uuml Yacute THORN szlig agrave aacute acirc atilde auml aring aelig ccedil egrave eacute ecirc euml igrave iacute icirc iuml eth ntilde ograve oacute ocirc otilde ouml divide oslash ugrave uacute ucirc uuml yacute thorn yuml OElig oelig Scaron scaron Yuml fnof circ tilde Alpha Beta Gamma Delta Epsilon Zeta Eta Theta Iota Kappa Lambda Mu Nu Xi Omicron Pi Rho Sigma Tau Upsilon Phi Chi Psi Omega alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu nu xi omicron pi rho sigmaf sigma tau upsilon phi chi psi omega thetasym upsih piv ensp emsp thinsp zwnj zwj lrm rlm ndash mdash lsquo rsquo sbquo ldquo rdquo bdquo dagger Dagger bull hellip permil prime Prime lsaquo rsaquo oline frasl euro image weierp real trade alefsym larr uarr rarr darr harr crarr lArr uArr rArr dArr hArr forall part exist empty nabla isin notin ni prod sum minus lowast radic prop infin ang and or cap cup int there4 sim cong asymp ne equiv le ge sub sup nsub sube supe oplus otimes perp sdot lceil rceil lfloor rfloor lang rang loz spades clubs hearts diams