Skip to content

Instantly share code, notes, and snippets.

@jrobinsonc
Last active March 17, 2020 14:05
Show Gist options
  • Save jrobinsonc/34ca7755a227330a4891332abb1f83c6 to your computer and use it in GitHub Desktop.
Save jrobinsonc/34ca7755a227330a4891332abb1f83c6 to your computer and use it in GitHub Desktop.
DROP FUNCTION `quit_accents`;
CREATE FUNCTION `quit_accents`(str longtext)
RETURNS longtext CHARSET utf8
BEGIN
DECLARE result LONGTEXT;
SET result = str;
SET result = REPLACE(result, 'á', 'a');
SET result = REPLACE(result, 'é', 'e');
SET result = REPLACE(result, 'í', 'i');
SET result = REPLACE(result, 'ó', 'o');
SET result = REPLACE(result, 'ú', 'u');
SET result = REPLACE(result, 'Á', 'A');
SET result = REPLACE(result, 'É', 'E');
SET result = REPLACE(result, 'Í', 'I');
SET result = REPLACE(result, 'Ó', 'O');
SET result = REPLACE(result, 'Ú', 'U');
SET result = REPLACE(result, 'ñ', 'n');
SET result = REPLACE(result, 'Ñ', 'N');
RETURN result;
END;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment