bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnu-libiconv] Feature request on translitterate


From: Bruno Haible
Subject: Re: [bug-gnu-libiconv] Feature request on translitterate
Date: Tue, 17 Apr 2018 23:42:05 +0200 (CEST)

> It would be useful if translitteration could be done only from one
> character to one character long string.
> In the context of EDIFACT, or flat files, the length in number of
> characters matters.
> So translitterating "€" to "EUR" is not an option.

You can implement your desired feature as a string processing function in C,
based on iconv(), in a way that
  1. works with all iconv() implementations that support '//TRANSLIT'
     (that include glibc and GNU libiconv),
  2. works with all encodings and in all locales.

The starting point of this implementation is a function that converts one
character at a time, like the function iconv_carefully_1 in
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/striconveh.c .
Then you need a function that determines the number of characters in the
conversion result of a character; this one too is based on iconv_carefully_1,
but on iconv_open(DESTINATION,DESTINATION). With these two building bricks
you can do it.

Therefore there is no need to bother GNU libiconv (or any iconv() 
implementation)
to achieve your desired feature.

Bruno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]