Ver Mensaje Individual
  #5 (permalink)  
Antiguo 24/10/2004, 14:33
Avatar de Saruman
Saruman
 
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 22 años
Puntos: 5
aqui hay algo para transformar el texto que queremos insertar por medio de sql y que no nos mande error de comillas, apostrofes, etc.

hice dos funciones: una que convierte el texto y otra que lo codifica...
solo converti los caracteres "extraños"

para ver una lista completa de códigos html en hex, ascii, etc. vallan a http://ascii.cl/es/codigos-html.htm


Código:
'Codifica el Texto
	Function EncodeText(strTexto)
		if strTexto <> "" or isnull(strTexto) = false then
			for I = 33 to 47
				if I <> 35 and I <> 38 then
					strTexto = replace(strTexto, chr(I), "&#" & I & ";")
				end if
			next
			
			for I = 58 to 63
				if I <> 59 then
					strTexto = replace(strTexto, chr(I), "&#" & I & ";")
				end if
			next
			
			for I = 91 to 96
				strTexto = replace(strTexto, chr(I), "&#" & I & ";")
			next
			
			for I = 123 to 126
				strTexto = replace(strTexto, chr(I), "&#" & I & ";")
			next
			
			for I = 161 to 255
				strTexto = replace(strTexto, chr(I), "&#" & I & ";")
			next
		else
			strTexto = ""
		end if
		
		EncodeText = strTexto
	End Function
	
	'Decodifica el Texto
	Function DecodeText(strTexto)
		if strTexto <> "" or isnull(strTexto) = false then
			for I = 33 to 47
				if I <> 35 and I <> 38 then
					strTexto = replace(strTexto, "&#" & I & ";", chr(I))
				end if
			next
			
			for I = 58 to 63
				if I <> 59 then
					strTexto = replace(strTexto, "&#" & I & ";", chr(I))
				end if
			next
			
			for I = 91 to 96
				strTexto = replace(strTexto, "&#" & I & ";", chr(I))
			next
			
			for I = 123 to 126
				strTexto = replace(strTexto, "&#" & I & ";", chr(I))
			next
			
			for I = 161 to 255
				strTexto = replace(strTexto, "&#" & I & ";", chr(I))
			next
		else
			strTexto = ""
		end if
		
		DecodeText = strTexto
	End Function
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.