Last active
December 24, 2015 00:59
-
-
Save rememberlenny/6721025 to your computer and use it in GitHub Desktop.
Replace SEO-unfriendly characters with their regular counter parts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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