Remove accents from a string in C

Is there a more efficient way to remove accents from a string without creating a large array with replaceable characters?

eg:

removeaccents("รกรจfoo") 

exit:

 aefoo 

there are no accents in the ASCII table, I have no idea how to do this. Thanks in advance.:)

+4
source share
1 answer

It looks like you are looking for unac() . On the man page:

unac is a C library that removes accents from characters, regardless of character set (ISO-8859-15, ISO-CELTIC, KOI8-RU ...), while iconv(3) can convert it to UTF-16 (Unicode) .

I could not find the download page (I think it means here , but currently 404 link). If you are on ubuntu, you can get it with:

 sudo apt-get install libunac1-dev 

Assuming you are using gcc, after installing it, you need to add -lunac to your compiler options (to tell the compiler a link to the unac library).

+7
source

Source: https://habr.com/ru/post/1401293/


All Articles