Portability of iconv's //TRANSLIT?

I was using a field normalizer (for URLs, sorting, etc) that has

Iconv.iconv(‘ascii//ignore//translit’, ‘utf-8’, s)

as a starting point. Accented characters such as “á” are “decomposed”
in my Mac, but the production machine is a Linux and they are ignored
there, so “á” becomes the empty string instead of “'a”.

In the Mac we have “iconv (GNU libiconv 1.9)”, in that linux we have
“iconv (GNU libc) 2.3.2”. Since the current release of GNU iconv is
1.11, I guess those are different libraries with different
transliteration tables. Is that right?

I have written a transliteration table as a chain of gsubs as a
workaround, but that approach was so good! Can anyone explain what is
actually happening and confirm whether that //TRANSLIT trick is non-
portable and thus better avoided?

– fxn

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs