Skip to content

Instantly share code, notes, and snippets.

@rememberlenny
Last active December 24, 2015 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rememberlenny/6721025 to your computer and use it in GitHub Desktop.
Save rememberlenny/6721025 to your computer and use it in GitHub Desktop.
Replace SEO-unfriendly characters with their regular counter parts
foreignChar: [
'ç','æ','œ','á','é',
'í','ó','ú','à','è',
'ì','ò','ù','ä','ë',
'ï','ö','ü','ÿ','â',
'ê','î','ô','û','å',
'e','i','ø','u','(',
')','[',']',' '
],
replaceChar: [
'c', 'ae','oe','a','e',
'i','o','u','a','e',
'i','o','u','a','e',
'i','o','u','y','a',
'e','i','o','u','a',
'e','i','o','u','',
'','','','-'
],
// Iterate URL for foreign characters
replaceForiegnCharWithNormal: function(splitQueryString){
for(i = 0; i > splitQueryString.length; i++){
// Check if character is a foreign character
if(splitQueryString[i] = this.foreignChar[i]){
// Replace foreign character with URL friendly character
splitQueryString[i] == this.replaceChar[i];
}
}
return splitQueryString;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment