tech-userlevel archive

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

how to determine codeset of the current locale?



Hi,

if a shell script relies on the fact that one of the "-t" or "-f"
switches for the iconv command can be omitted (see
http://www.opengroup.org/onlinepubs/000095399/utilities/iconv.html) it
fails on NetBSD 2/3/4 because this behaviour will only be possible starting
with NetBSD 5.

  NetBSD3$ echo a | iconv -f ascii -t utf-8
  a
  
  NetBSD3$ echo a | iconv -t utf-8
  Usage: iconv [-cs] -f <from> -t <to> [file ...]
          iconv -l

  NetBSD4.99.72$ echo a | iconv -t utf-8
  a

How can I determine the codeset of the current locale within a shell
script in order to supply the missing second option on NetBSD < 5?

ciao
     Klaus


Home | Main Index | Thread Index | Old Index