all-charsets 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. #! /bin/sh
  2. # Prints a table of the charsets (system dependent name and portable name)
  3. # for all locales.
  4. ${CC-cc} -o locale_codeset locale_codeset.c
  5. ${CC-cc} -o locale_charset -I../include locale_charset.c \
  6. -DHAVE_CONFIG_H -I.. -DLIBDIR='"'`cd ../lib && pwd`'"' \
  7. ../lib/localcharset.c
  8. printf '%-15s%-17s%-17s %-17s\n\n' \
  9. "locale name" "locale charmap" "nl_langinfo(CODESET)" "locale_charset()"
  10. for lc in `./all-locales | sort | uniq`
  11. do
  12. charmap=`LC_ALL=$lc ./locale_charmap 2>/dev/null || echo '<error>'`
  13. codeset=`LC_ALL=$lc ./locale_codeset 2>/dev/null || echo '<error>'`
  14. charset=`LC_ALL=$lc ./locale_charset 2>/dev/null || echo '<error>'`
  15. case "$charset" in
  16. ASCII | ANSI_X3.4-1968 | \
  17. ISO-8859-1 | ISO-8859-2 | ISO-8859-3 | ISO-8859-4 | ISO-8859-5 | ISO-8859-6 | \
  18. ISO-8859-7 | ISO-8859-8 | ISO-8859-9 | ISO-8859-13 | ISO-8859-14 | ISO-8859-15 | \
  19. KOI8-R | KOI8-U | KOI8-T | \
  20. CP437 | CP775 | CP850 | CP852 | CP855 | CP856 | CP857 | CP861 | CP862 | CP864 | CP865 | CP866 | CP869 | CP874 | CP922 | CP932 | CP943 | CP949 | CP950 | CP1046 | CP1124 | CP1125 | CP1129 | CP1131 | \
  21. CP1250 | CP1251 | CP1252 | CP1253 | CP1254 | CP1255 | CP1256 | CP1257 | \
  22. GB2312 | EUC-JP | EUC-KR | EUC-TW | BIG5 | BIG5-HKSCS | GBK | GB18030 | SHIFT_JIS | JOHAB | \
  23. TIS-620 | VISCII | TCVN5712-1 | ARMSCII-8 | GEORGIAN-PS | PT154 | \
  24. HP-ROMAN8 | HP-ARABIC8 | HP-GREEK8 | HP-HEBREW8 | HP-TURKISH8 | HP-KANA8 | \
  25. DEC-KANJI | DEC-HANYU | \
  26. UTF-8 ) comment="";;
  27. * ) comment="bug";;
  28. esac
  29. printf '%-15s %-17s %-17s %-17s %s\n' \
  30. "$lc" "$charmap" "$codeset" "$charset" "$comment"
  31. done