Is there is a more efficient way to remove accents from string without make an big array with the characters to replace?
For example:
removeaccents("áèfoo")
Output:
aefoo
In the ASCII table there no accents, I have no idea how to do this. Thanks in advance. :)
Use java. text. Normalizer to handle this for you. This will separate all of the accent marks from the characters.
Sounds like you're looking for unac()
. From the man page:
unac
is a C library that removes accents from characters, regardless of the character set (ISO-8859-15, ISO-CELTIC, KOI8-RU...) as long asiconv(3)
is able to convert it into UTF-16 (Unicode).
I couldn't find the download page (I think it's meant to be here, but the link is currently 404ing). If you're on ubuntu, you can get it with:
sudo apt-get install libunac1-dev
Assuming you're using gcc, once it's installed you'll need to add -lunac
to your compiler options (to tell the compiler to link with the unac library).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With