1

I'm working on a program in C, I need to be able to get the code of a character, but in the case of an accented character like "á", it must return the code of the character "a" and the accent (´).

in:
á
out:
"á"=C3 A1
"a"=61
"´"=C2 B4

Is there a way to get the accent? This should work for any type of combining characters (acute, grave, diaeresis, circumflex ...)

In some projects I have used iconv to convert between encodings, but I don't know how to solve this problem.

Or is it possible with iconv to do that? Something like

in: cómo estás, niño?
out c´omo est´as, ni~no?
fenixero
  • 11
  • 3
  • 6
    You're asking for the "Normalization Form D (NFD)" of the input. Beyond that, this becomes a library recommendation question, which is off-topic. – ikegami Jan 29 '21 at 05:33
  • Agree. This is a very generic question. Have you tried any lib so far? If so, then you can pose a more specific question. – MCL Jan 29 '21 at 06:55
  • Here you can get information about a character https://unicodelookup.com, might help as inspiration for your C library. – goetz Feb 05 '21 at 17:26

0 Answers0