====== Fonction de remplacement des code HTML des caractères spéciaux par les caractères ======
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;