def replace_characters(name)
name.downcase.tr('àáäâãèéëẽêìíïîĩòóöôõùúüûũñç ', 'aaaaaeeeeeiiiiiooooouuuuunc-')
end
I want to replace special characters for normal characters but keeping the case.
Examples and their expected outputs:
- íhávéspécialchárs.jpg // ihavespecialchars.jpg
- ÍHÁVÉSPÉCIALCHÁRS.JPG // IHAVESPECIALCHARS.JPG
- /IMG_4834.JPG // /IMG_4834.JPG
Currently, it's replacing fine, but always changing the string to lowercase. Eg: /IMG_4834.JPG -> /img_4834.jpg