Accents/tildes to HTML Entities


/ Published in: ASP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.