Depending on iconv -t ascii//translit on Red Hat was a mistake
I recently re-learned that moving code from one Linux distribution to another doesn’t always pan out as expected. Especially when that second distribution is Red Hat Enterprise Linux.
Part of my code depended on the iconv program to convert some special Scandinavian characters to ASCII with transliteration. The code in question worked as expected on my Slackware development box, so I was unprepared for the issues ahead. The following one-liner illustrates the problem:
# Slackware export LANG=nb_NO.utf8 iconv -f UTF-8 -t ASCII//TRANSLIT <<< 'Æ,æ,Ø,ø,Å,å' AE,ae,OE,oe,AA,aa # RHEL export LANG=nb_NO.utf8 iconv -f UTF-8 -t ASCII//TRANSLIT <<< 'Æ,æ,Ø,ø,Å,å' AE,ae,?,?,A,a
This code was later responsible for renaming thousands of image files and updating the corresponding database records. Predictably, it didn’t exactly turn out to be my best day at the office.
In the end, my downfall was caused by a “bug” with glibc that was subsequently fixed in later releases. I don’t expect to see that fix backported to Red Hat 7.x. though.