# /etc/profile.d/z_langfix_local.csh - fix RH'slang.csh
# $Id: //depot/ops/corp/grhat/tree/etc/profile.d/z_langfix_local.csh#7 $

# For remote connections, we assume the remote terminal can't do UTF-8
# (most can't)
if ( $?TERM ) then
# Let's comment out some of that nonsense now that UTF-8 isn't a default anymore
    #if ( $?SSH_TTY || z"$TERM" == zscreen || $?TERMCANNOTDOUTF8 ) then
    if ( $?SSH_TTY || z"$TERM" == zscreen ) then
	if ( $?LANG ) then
	   expr "$LANG" : ".*UTF" >&/dev/null
	   if ( $? == 0 ) setenv LANG en_US.ISO-8859-1
	endif
    endif
endif


# This is a hack for Eterm since it doesn't support UTF8
if ( $?TERM ) then
    if ( z"$TERM" == zEterm ) then
	# Some apps (like mutt) or computers (non linux) do not deal well with
	# TERM==Eterm, so we change that back to xterm
	setenv TERM xterm
        # This is an infamous trick because we get parsed at least twice
        # (/etc/profile and /etc/bashrc), so we need to remember we were
        # an Eterm
	setenv TERMCANNOTDOUTF8 yes

	if ( $?LANG ) then
	   expr "$LANG" : ".*UTF" >&/dev/null
	   if ( $? == 0 ) setenv LANG en_US.ISO-8859-1
	endif
    endif
endif
