geoadmin/mf-chsdi3 — pull request #136 by loicgasser (2013-10-08 10:32:47+00:00)
Title: Use same rule for accents as in pgadmin

-- Function: remove_accents(character varying)

-- DROP FUNCTION remove_accents(character varying);

CREATE OR REPLACE FUNCTION remove_accents(string character varying)
RETURNS character varying AS
$BODY$
DECLARE
res varchar;
BEGIN
res := replace(string, 'ü', 'ue');
res := replace(res, 'Ü', 'ue');
res := replace(res, 'ä', 'ae');
res := replace(res, 'Ä', 'ae');
res := replace(res, 'ö', 'oe');
res := replace(res, 'Ö', 'oe');
res := replace(res, '(', '_');
res := replace(res, ')', '_');

res:= translate(res, 'àáâÀÁÂ', 'aaaaaa');
res:= translate(res, 'èéêëÈÉÊË', 'eeeeeeee');
res:= translate(res, 'ìíîïÌÍÎÏ', 'iiiiiiii');
res:= translate(res, 'òóôÒÓÔ', 'oooooo');
res:= translate(res, 'ùúûÙÚÛ', 'uuuuuu');
res:= translate(res, 'ç', 'c');

RETURN trim(lower(res));
END;
$BODY$
LANGUAGE plpgsql IMMUTABLE
COST 100;
ALTER FUNCTION remove_accents(character varying)
OWNER TO postgres;

This is the function we use in postgresql to remove accents.
Here we simply needed to adapt it to behave the same way in CHSDI3.