LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting LC_CTYPE in XTerm under MDK/WM (https://www.linuxquestions.org/questions/linux-newbie-8/setting-lc_ctype-in-xterm-under-mdk-wm-119304/)

martint 11-23-2003 07:09 PM

Setting LC_CTYPE in XTerm under MDK/WM
 
Currently I run mdk9.1 and windowmaker 0.8. In windowmaker I run an XTerm.
First I had problems with my man pages in this XTerm: All "-" was replaced by weird stuff. I found a solution: export LC_CTYPE=C.

My problem is to load this at startup!

I tried to put it in my ~/.bashrc
With this setting LC_CTYPE is set right in console (ie not under X),
but in my XTerm (under X) I have:
$ echo $LC_CTYPE
da_DK.UTF-8

Where should this command be placed?
(~/.bash_profile doesn't work)

Thx in advance

Tinkster 11-23-2003 08:27 PM

Depends on whether the xterms in wm are
login shells or not. You could try to symlink
(ln -s ~/.bashrc ~/.bash_login)


Cheers,
Tink

martint 11-24-2003 12:32 PM

Nope, that doesnt work. Not a login shell.

Tinkster 11-24-2003 01:43 PM

is ~/.bashrc executable?

Cheers,
Tink

martint 11-24-2003 02:48 PM

No it wasn't. (Should it be?) Anyway I tried to make it exec. and it didn't work :-(

Could it be, that my XTerm is started with an argument setting the locale (LC_CTYPE)?
Where can I find out?
What starts the XTerm?

Thanx!

Tinkster 11-24-2003 02:56 PM

Quote:

Originally posted by martint
]No it wasn't. (Should it be?) Anyway I tried to make it exec. and it didn't work :-(
Why/how did it not work?
What's the error message?

Quote:

Could it be, that my XTerm is started with an argument setting the locale (LC_CTYPE)?
Where can I find out?
What starts the XTerm?

Thanx!
How do you start it? :)

have a look at ~
ls ls -Ald .*
Maybe there's another .bash-file (.bash_profile)
or .profile that messes with you?



Cheers,
Tink

martint 11-24-2003 03:52 PM

My .bash_profile is just:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export PATH=$PATH:$HOME/bin
unset USERNAME

My .bashrc reads:
# .bashrc
# User specific aliases and functions
[snip]
# This locale setting should fix the "-" and "--" in man pages.
# Works in console, but is overwritten somewhere else in WM.
export LC_CTYPE=C
echo "LC_CTYPE="$LC_CTYPE
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

I tried to place "export LC_CTYPE=C" in .bash_profile too, but that doesnt work.

How do i run my XTerm:
I use WM so I can run both XTerm and rxvt from the menu. They run:
xterm -sb
rxvt -bg black -fg white -fn fixed
(I then start them automatically from the dock.)
Both XTerm and rxvt has LC_CTYPE=da_DK.UTF-8

martint 11-24-2003 04:03 PM

I found out that if I run
bash --login
in my XTerm, it sets LC_CTYPE=C. Can this be any help? My /etc/bashrc is:

# /etc/bashrc
echo "Loading /etc/bashrc"

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
umask 002
else
umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
;;
*)
;;
esac
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

if [ -z "$loginsh" ]; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -x $i ]; then
. $i
fi
done
fi
fi

unset loginsh

martint 11-24-2003 04:20 PM

# /etc/profile.d/lang.sh - set i18n stuff
sourced=0
if [ -n "$GDM_LANG" ]; then
sourced=1
LANG="$GDM_LANG"
else
# only source one of the possible files, and in that order;
# if system wide and user config are mixed and different, umpredictable
# things will happen...
for langfile in $HOME/.i18n /etc/sysconfig/i18n ; do
[ -f $langfile -a "$sourced" = "0" ] && . $langfile && sourced=1
done
fi
if [ "$sourced" = 1 ]; then
if [ -n "$LANG" ] ; then
[ "$LANG" = "C" ] && LANG="en_US"
export LANG
else
unset LANG
fi
[ -n "$LANG" ] && export LANG || unset LANG
[ -n "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS
[ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
###################################################
[snip]

How does this affect LC_CTYPE in a non-login shell?

Tinkster 11-24-2003 04:25 PM

Good question ... not sure how stuff is
dealt with in wm, but could the shells
inherit from the wm process which
most likely will be a login-shell? :)


Cheers,
Tink

martint 11-24-2003 04:55 PM

Problem Solved!!!
 
I'm happy to anounce that the problem is solved. I found that:
~/.bashrc calls etc/profile.d/lang.sh, which in turn modifies LC_CTYPE (in some way i dont understand (yet)). So placing

export LC_CTYPE=C

ABOVE

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

makes my manual pages happy :-)

Many thanks to you, Tinkster, for being so patient with me.

arkanoize 03-08-2004 03:11 PM

Another way: to set or remove 'LC_CTYPE=' to the desired value in /etc/environmet.

I


All times are GMT -5. The time now is 04:15 AM.