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?


if a shell script relies on the fact that one of the "-t" or "-f"
switches for the iconv command can be omitted (see 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
  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

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?


Home | Main Index | Thread Index | Old Index