Posted By

sulfurito on 09/18/08


Tagged

character conversion entities


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Scooter
stav
clac


Accents/tildes to HTML Entities


 / Published in: ASP
 

Chars with accents to HTML Entities Caracteres con tildes o acentos pasados a HTML Entities

  1. 'Cambia los caracteres con tildes y ñ por el nombre en HTML
  2. Function tildes2Entities(texto)
  3. If not EsNulo(texto) Then
  4. texto = Replace(texto, "¡", "¡")
  5. texto = Replace(texto, "¿", "¿")
  6. 'texto = Replace(texto, "'", "'")
  7.  
  8. texto = Replace(texto, "á", "á")
  9. texto = Replace(texto, "é", "é")
  10. texto = Replace(texto, "í", "í")
  11. texto = Replace(texto, "ó", "ó")
  12. texto = Replace(texto, "ú", "ú")
  13. texto = Replace(texto, "ñ", "ñ")
  14. texto = Replace(texto, "ç", "ç")
  15.  
  16. texto = Replace(texto, "Á", "Á")
  17. texto = Replace(texto, "É", "É")
  18. texto = Replace(texto, "Í", "Í")
  19. texto = Replace(texto, "Ó", "Ó")
  20. texto = Replace(texto, "Ú", "Ú")
  21. texto = Replace(texto, "Ñ", "Ñ")
  22. texto = Replace(texto, "Ç", "Ç")
  23.  
  24. texto = Replace(texto, "à", "à")
  25. texto = Replace(texto, "è", "è")
  26. texto = Replace(texto, "ì", "ì")
  27. texto = Replace(texto, "ò", "ò")
  28. texto = Replace(texto, "ù", "ù")
  29.  
  30. texto = Replace(texto, "À", "À")
  31. texto = Replace(texto, "È", "È")
  32. texto = Replace(texto, "Ì", "Ì")
  33. texto = Replace(texto, "Ò", "Ò")
  34. texto = Replace(texto, "Ù", "Ù")
  35.  
  36. texto = Replace(texto, "ä", "ä")
  37. texto = Replace(texto, "ë", "ë")
  38. texto = Replace(texto, "ï", "ï")
  39. texto = Replace(texto, "ö", "ö")
  40. texto = Replace(texto, "ü", "ü")
  41.  
  42. texto = Replace(texto, "Ä", "Ä")
  43. texto = Replace(texto, "Ë", "Ë")
  44. texto = Replace(texto, "Ï", "Ï")
  45. texto = Replace(texto, "Ö", "Ö")
  46. texto = Replace(texto, "Ü", "Ü")
  47.  
  48. texto = Replace(texto, "â", "â")
  49. texto = Replace(texto, "ê", "ê")
  50. texto = Replace(texto, "î", "î")
  51. texto = Replace(texto, "ô", "ô")
  52. texto = Replace(texto, "û", "û")
  53.  
  54. texto = Replace(texto, "Â", "Â")
  55. texto = Replace(texto, "Ê", "Ê")
  56. texto = Replace(texto, "Î", "Î")
  57. texto = Replace(texto, "Ô", "Ô")
  58. texto = Replace(texto, "Û", "Û")
  59. Else
  60. texto = ""
  61. End If
  62. tildes2Entities = texto
  63. End Function

Report this snippet  

You need to login to post a comment.