CREATE OR REPLACE FUNCTION no_html_specials_chars(text)
RETURNS text AS
$BODY$
DECLARE
var_texte ALIAS FOR $1;
var_chaine text;
BEGIN
var_chaine:=var_texte;
var_chaine:=REPLACE(var_chaine,'"','"');
var_chaine:=REPLACE(var_chaine,'&','&');
var_chaine:=REPLACE(var_chaine,'€','€');
var_chaine:=REPLACE(var_chaine,'<','<');
var_chaine:=REPLACE(var_chaine,'>','>');
var_chaine:=REPLACE(var_chaine,'œ','œ');
var_chaine:=REPLACE(var_chaine,'','z');
var_chaine:=REPLACE(var_chaine,'Ÿ','Y');
var_chaine:=REPLACE(var_chaine,' ','Space');
var_chaine:=REPLACE(var_chaine,'¡','¡');
var_chaine:=REPLACE(var_chaine,'¢','¢');
var_chaine:=REPLACE(var_chaine,'£','£');
var_chaine:=REPLACE(var_chaine,'¤','¤');
var_chaine:=REPLACE(var_chaine,'¥','¥');
var_chaine:=REPLACE(var_chaine,'¦','¦');
var_chaine:=REPLACE(var_chaine,'§','§');
var_chaine:=REPLACE(var_chaine,'¨','¨');
var_chaine:=REPLACE(var_chaine,'©','©');
var_chaine:=REPLACE(var_chaine,'ª','ª');
var_chaine:=REPLACE(var_chaine,'«','«');
var_chaine:=REPLACE(var_chaine,'¬','¬');
var_chaine:=REPLACE(var_chaine,'­','');
var_chaine:=REPLACE(var_chaine,'®','®');
var_chaine:=REPLACE(var_chaine,'&masr;','¯');
var_chaine:=REPLACE(var_chaine,'°','°');
var_chaine:=REPLACE(var_chaine,'±','±');
var_chaine:=REPLACE(var_chaine,'²','²');
var_chaine:=REPLACE(var_chaine,'³','³');
var_chaine:=REPLACE(var_chaine,'´','''');
var_chaine:=REPLACE(var_chaine,'µ','µ');
var_chaine:=REPLACE(var_chaine,'¶','¶');
var_chaine:=REPLACE(var_chaine,'·','·');
var_chaine:=REPLACE(var_chaine,'¸','¸');
var_chaine:=REPLACE(var_chaine,'¹','¹');
var_chaine:=REPLACE(var_chaine,'º','º');
var_chaine:=REPLACE(var_chaine,'»','»');
var_chaine:=REPLACE(var_chaine,'¼','¼');
var_chaine:=REPLACE(var_chaine,'½','½');
var_chaine:=REPLACE(var_chaine,'¾','¾');
var_chaine:=REPLACE(var_chaine,'¿','¿');
var_chaine:=REPLACE(var_chaine,'À','À');
var_chaine:=REPLACE(var_chaine,'Á','Á');
var_chaine:=REPLACE(var_chaine,'Â','Â');
var_chaine:=REPLACE(var_chaine,'Ã','Ã');
var_chaine:=REPLACE(var_chaine,'Ä','Ä');
var_chaine:=REPLACE(var_chaine,'Å','Å');
var_chaine:=REPLACE(var_chaine,'&Aelig','Æ');
var_chaine:=REPLACE(var_chaine,'Ç','Ç');
var_chaine:=REPLACE(var_chaine,'È','È');
var_chaine:=REPLACE(var_chaine,'É','É');
var_chaine:=REPLACE(var_chaine,'Ê','Ê');
var_chaine:=REPLACE(var_chaine,'Ë','Ë');
var_chaine:=REPLACE(var_chaine,'Ì','Ì');
var_chaine:=REPLACE(var_chaine,'Í','Í');
var_chaine:=REPLACE(var_chaine,'Î','Î');
var_chaine:=REPLACE(var_chaine,'Ï','Ï');
var_chaine:=REPLACE(var_chaine,'ð','Ð');
var_chaine:=REPLACE(var_chaine,'Ñ','Ñ');
var_chaine:=REPLACE(var_chaine,'Ò','Ò');
var_chaine:=REPLACE(var_chaine,'Ó','Ó');
var_chaine:=REPLACE(var_chaine,'Ô','Ô');
var_chaine:=REPLACE(var_chaine,'Õ','Õ');
var_chaine:=REPLACE(var_chaine,'Ö','Ö');
var_chaine:=REPLACE(var_chaine,'×','×');
var_chaine:=REPLACE(var_chaine,'Ø','Ø');
var_chaine:=REPLACE(var_chaine,'Ù','Ù');
var_chaine:=REPLACE(var_chaine,'Ú','Ú');
var_chaine:=REPLACE(var_chaine,'Û','Û');
var_chaine:=REPLACE(var_chaine,'Ü','Ü');
var_chaine:=REPLACE(var_chaine,'Ý','Ý');
var_chaine:=REPLACE(var_chaine,'þ','Þ');
var_chaine:=REPLACE(var_chaine,'ß','ß');
var_chaine:=REPLACE(var_chaine,'à','à');
var_chaine:=REPLACE(var_chaine,'á','á');
var_chaine:=REPLACE(var_chaine,'â','â');
var_chaine:=REPLACE(var_chaine,'ã','ã');
var_chaine:=REPLACE(var_chaine,'ä','ä');
var_chaine:=REPLACE(var_chaine,'å','å');
var_chaine:=REPLACE(var_chaine,'æ','æ');
var_chaine:=REPLACE(var_chaine,'ç','ç');
var_chaine:=REPLACE(var_chaine,'è','è');
var_chaine:=REPLACE(var_chaine,'é','é');
var_chaine:=REPLACE(var_chaine,'ê','ê');
var_chaine:=REPLACE(var_chaine,'ë','ë');
var_chaine:=REPLACE(var_chaine,'ì','ì');
var_chaine:=REPLACE(var_chaine,'í','í');
var_chaine:=REPLACE(var_chaine,'î','î');
var_chaine:=REPLACE(var_chaine,'ï','ï');
var_chaine:=REPLACE(var_chaine,'ð','ð');
var_chaine:=REPLACE(var_chaine,'ñ','ñ');
var_chaine:=REPLACE(var_chaine,'ò','ò');
var_chaine:=REPLACE(var_chaine,'ó','ó');
var_chaine:=REPLACE(var_chaine,'ô','ô');
var_chaine:=REPLACE(var_chaine,'õ','õ');
var_chaine:=REPLACE(var_chaine,'ö','ö');
var_chaine:=REPLACE(var_chaine,'÷','÷');
var_chaine:=REPLACE(var_chaine,'ø','ø');
var_chaine:=REPLACE(var_chaine,'ù','ù');
var_chaine:=REPLACE(var_chaine,'ú','ú');
var_chaine:=REPLACE(var_chaine,'û','û');
var_chaine:=REPLACE(var_chaine,'ü','ü');
var_chaine:=REPLACE(var_chaine,'ý','ý');
var_chaine:=REPLACE(var_chaine,'þ','þ');
var_chaine:=REPLACE(var_chaine,'ÿ','ÿ');
RETURN var_chaine;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION no_html_specials_chars(text) OWNER TO dba;