#!/bin/sh

# get the charmap of current system locale setting

test -e /etc/SuSEconfig/profile && . /etc/SuSEconfig/profile
test -e /etc/profile.d/lang.sh  && . /etc/profile.d/lang.sh

eval $(locale -k charmap)

case "$charmap" in
	UTF-8)
		iocharset="utf8"
		;;
	BIG5|BIG5-HKSCS|EUC-TW)
		iocharset="cp950"
		;;
	CP1251)
		iocharset="cp1251"
		;;
	CP1255)
		iocharset="cp1255"
		;;
	EUC-JP)
		iocharset="euc-jp"
		;;
	EUC-KR)
		iocharset="cp949"
		;;
	GB18030|GBK|GB2312)
		iocharset="cp936"
		;;
	ISO-8859-*)
		iocharset="iso8859-${charmap##ISO-8859-}"
		;;
	KOI8-R)
		iocharset="koi8-r"
		;;
	KOI8-U)
		iocharset="koi8-u"
		;;
	SHIFT_JIS)
		iocharset="cp932"
		;;
	TIS-620)
		iocharset="cp874"
		;;
esac	

echo $iocharset

