Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.advocacy > #412811 > unrolled thread
| Started by | DFS <nospam@dfs.com> |
|---|---|
| First post | 2017-05-04 08:15 -0400 |
| Last post | 2017-05-08 09:59 -0700 |
| Articles | 10 — 4 participants |
Back to article view | Back to comp.os.linux.advocacy
How do I fix this shell encoding issue? DFS <nospam@dfs.com> - 2017-05-04 08:15 -0400
Re: How do I fix this shell encoding issue? Steve Carroll <fretwizzer@gmail.com> - 2017-05-04 09:23 -0700
Re: How do I fix this shell encoding issue? DFS <nospam@dfs.com> - 2017-05-08 08:01 -0400
Re: How do I fix this shell encoding issue? owl <owl@rooftop.invalid> - 2017-05-08 16:11 +0000
Re: How do I fix this shell encoding issue? DFS <nospam@dfs.com> - 2017-05-08 08:37 -0400
Re: How do I fix this shell encoding issue? owl <owl@rooftop.invalid> - 2017-05-08 17:19 +0000
Re: How do I fix this shell encoding issue? DFS <nospam@dfs.com> - 2017-05-08 14:29 -0400
Re: How do I fix this shell encoding issue? fr314159@gmail.com - 2017-05-08 09:10 -0700
Re: How do I fix this shell encoding issue? DFS <nospam@dfs.com> - 2017-05-08 08:30 -0400
Re: How do I fix this shell encoding issue? fr314159@gmail.com - 2017-05-08 09:59 -0700
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2017-05-04 08:15 -0400 |
| Subject | How do I fix this shell encoding issue? |
| Message-ID | <oefjvl$85d$1@dont-email.me> |
I wrote a C program on Linux that did something to my locale setting. Now every time I start a bash shell it looks like this 崛㬰晤䁳慭橮牡㩯栯浯⽥晤ݳ嬛㌻洲摛獦浀湡慪潲嬛㌻洷縠嬛㌻洲嬛〰 http://imgur.com/Wp1GwMIl.png and I have to go to Terminal | Set Encoding | Default UTF-8 to get back the prompt in English. Where/how do I fix this? Thanks
[toc] | [next] | [standalone]
| From | Steve Carroll <fretwizzer@gmail.com> |
|---|---|
| Date | 2017-05-04 09:23 -0700 |
| Message-ID | <bbf13c17-be82-4d36-ba98-1d2e31eab1cc@googlegroups.com> |
| In reply to | #412811 |
On Thursday, May 4, 2017 at 10:16:59 AM UTC-6, DFS wrote: > I wrote a C program on Linux that did something to my locale setting. > > Now every time I start a bash shell it looks like this > > 崛㬰晤䁳慭橮牡㩯栯浯⽥晤ݳ嬛㌻洲摛獦浀湡慪潲嬛㌻洷縠嬛㌻洲嬛〰 That's the J Godhe virus, written by Takuya Saitoh. The only solution is to send your computer to Godhe's place for a proper burial in his yard in between the bones of disenfranchised farm animals and others in the Godhe lineage.
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2017-05-08 08:01 -0400 |
| Message-ID | <oeq4ia$e2t$1@dont-email.me> |
| In reply to | #412811 |
On 05/04/2017 08:15 AM, DFS wrote: > I wrote a C program on Linux that did something to my locale setting. > > Now every time I start a bash shell it looks like this > > 崛㬰晤䁳慭橮牡㩯栯浯⽥晤ݳ嬛㌻洲摛獦浀湡慪潲嬛㌻洷縠嬛㌻洲嬛〰 > > http://imgur.com/Wp1GwMIl.png > > and I have to go to Terminal | Set Encoding | Default UTF-8 to get back > the prompt in English. > > Where/how do I fix this? > > Thanks Bump
[toc] | [prev] | [next] | [standalone]
| From | owl <owl@rooftop.invalid> |
|---|---|
| Date | 2017-05-08 16:11 +0000 |
| Message-ID | <zxcv8983.ag@rooftop.invalid> |
| In reply to | #413834 |
DFS <nospam@dfs.com> wrote: > On 05/04/2017 08:15 AM, DFS wrote: >> I wrote a C program on Linux that did something to my locale setting. >> >> Now every time I start a bash shell it looks like this >> >> 崛㬰晤䁳慭橮牡㩯栯浯⽥晤ݳ嬛?㌻洲摛獦浀湡慪潲嬛?㌻洷縠嬛?㌻洲?嬛〰 >> >> http://imgur.com/Wp1GwMIl.png >> >> and I have to go to Terminal | Set Encoding | Default UTF-8 to get back >> the prompt in English. >> >> Where/how do I fix this? >> >> Thanks > > > Bump Is it just in that one terminal app? What does PS1 look like in .bashrc? Post the code for the program that is responsible.
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2017-05-08 08:37 -0400 |
| Message-ID | <oeq6mu$m9j$1@dont-email.me> |
| In reply to | #413836 |
On 05/08/2017 12:11 PM, owl wrote:
> DFS <nospam@dfs.com> wrote:
>> On 05/04/2017 08:15 AM, DFS wrote:
>>> I wrote a C program on Linux that did something to my locale setting.
>>>
>>> Now every time I start a bash shell it looks like this
>>>
>>> 崛㬰晤䁳慭橮牡㩯栯浯⽥晤ݳ嬛?㌻洲摛獦浀湡慪潲嬛?㌻洷縠嬛?㌻洲?嬛〰
>>>
>>> http://imgur.com/Wp1GwMIl.png
>>>
>>> and I have to go to Terminal | Set Encoding | Default UTF-8 to get back
>>> the prompt in English.
>>>
>>> Where/how do I fix this?
>>>
>>> Thanks
>>
>>
>> Bump
> Is it just in that one terminal app?
Yeah
> What does PS1 look like in .bashrc?
There's no PS1 entry in .bashrc.
.extend.bashrc has a whole section related to PS1
> Post the code for the program that is responsible.
If I could find that code I could probably fix this little issue.
#
# ~/.bashrc
#
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done
echo; echo
done
}
[[ -f ~/.extend.bashrc ]] && . ~/.extend.bashrc
[ -r /usr/share/bash-completion/bash_completion ] && .
/usr/share/bash-completion/bash_completion
#
# ~/.bash_profile
#
[[ -f ~/.extend.bash_profile ]] && . ~/.extend.bash_profile
[[ -f ~/.bashrc ]] && . ~/.bashrc
#
# ~/.extend.bashrc
#
# Change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
PROMPT_COMMAND='echo -ne
"\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
;;
screen*)
PROMPT_COMMAND='echo -ne
"\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
;;
esac
use_color=true
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\][\h\[\033[01;36m\]
\W\[\033[01;31m\]]\$\[\033[00m\] '
else
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\]
\W\[\033[01;32m\]]\$\[\033[00m\] '
fi
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi
unset use_color safe_term match_lhs sh
alias cp="cp -i" # confirm before overwriting
something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias np='nano -w PKGBUILD'
alias more=less
xhost +local:root > /dev/null 2>&1
complete -cf sudo
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
shopt -s expand_aliases
# export QT_SELECT=4
# Enable history appending instead of overwriting. #139609
shopt -s histappend
#
# # ex - archive extractor
# # usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# better yaourt colors
export
YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35"
[toc] | [prev] | [next] | [standalone]
| From | owl <owl@rooftop.invalid> |
|---|---|
| Date | 2017-05-08 17:19 +0000 |
| Message-ID | <azc903.aub@rooftop.invalid> |
| In reply to | #413847 |
DFS <nospam@dfs.com> wrote: > On 05/08/2017 12:11 PM, owl wrote: >> DFS <nospam@dfs.com> wrote: >>> On 05/04/2017 08:15 AM, DFS wrote: >>>> I wrote a C program on Linux that did something to my locale setting. >>>> >>>> Now every time I start a bash shell it looks like this >>>> >>>> 崛㬰晤䁳慭橮牡㩯栯浯⽥晤ݳ嬛?㌻洲摛獦浀湡慪潲嬛?㌻洷縠嬛?㌻洲?嬛〰 >>>> >>>> http://imgur.com/Wp1GwMIl.png >>>> >>>> and I have to go to Terminal | Set Encoding | Default UTF-8 to get back >>>> the prompt in English. >>>> >>>> Where/how do I fix this? >>>> >>>> Thanks >>> >>> >>> Bump > > > >> Is it just in that one terminal app? > > Yeah > > >> What does PS1 look like in .bashrc? > > There's no PS1 entry in .bashrc. > > .extend.bashrc has a whole section related to PS1 > > >> Post the code for the program that is responsible. > > If I could find that code I could probably fix this little issue. > In Mate (gnome2), in dconf-editor, org->mate->terminal->global has "active-encodings". Clicking on "Set to Default" changes the mate-terminal character-encoding options to just "Current locale (UTF-8)" and "Unicode (UTF-8)".
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2017-05-08 14:29 -0400 |
| Message-ID | <oeqa17$467$1@dont-email.me> |
| In reply to | #413869 |
On 05/08/2017 01:19 PM, owl wrote: > In Mate (gnome2), in dconf-editor, org->mate->terminal->global > has "active-encodings". Clicking on "Set to Default" > changes the mate-terminal character-encoding options > to just "Current locale (UTF-8)" and "Unicode (UTF-8)". It's the xfce4-Terminal app. I fixed it. Just went into Preferences | Advanced and it was set to UTF-16. Thanks.
[toc] | [prev] | [next] | [standalone]
| From | fr314159@gmail.com |
|---|---|
| Date | 2017-05-08 09:10 -0700 |
| Message-ID | <324f900f-d009-4b58-92d0-a0259f8bb664@googlegroups.com> |
| In reply to | #412811 |
On Thursday, May 4, 2017 at 12:16:59 PM UTC-4, DFS wrote: > > Where/how do I fix this? > On a GNU/Linux system the locale setting is located in an environmental variable that is set during user login via an entry in the bashrc file. Check if the bashrc file contains the correct variable setting. To view all env vars do "printenv | sort | less" Locale vars are, IIRC, LC_ALL, and LC*.
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2017-05-08 08:30 -0400 |
| Message-ID | <oeq6ar$lkg$1@dont-email.me> |
| In reply to | #413835 |
On 05/08/2017 12:10 PM, fr314159@gmail.com wrote:
> On Thursday, May 4, 2017 at 12:16:59 PM UTC-4, DFS wrote:
>
>>
>> Where/how do I fix this?
>>
>
> On a GNU/Linux system the locale setting is located in
> an environmental variable that is set during user login
> via an entry in the bashrc file.
>
> Check if the bashrc file contains the correct variable
> setting.
>
> To view all env vars do "printenv | sort | less"
>
> Locale vars are, IIRC, LC_ALL, and LC*.
I forgot to say: before I ever posted this issue I looked in .bashrc and
.bash_profile and .extend.bashrc and didn't see anything that looked
suspicious to me, or anything related to locale.
With the encoding set to that Asian character set I can't read the
terminal to enter 'printenv'. So I have to do Terminal | Set Encoding |
UTF-8, which fixes it, and then all the LC* environment entries say:
LC_MEASUREMENT=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_TIME=en_US.UTF-8
#
# ~/.bashrc
#
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done
echo; echo
done
}
[[ -f ~/.extend.bashrc ]] && . ~/.extend.bashrc
[ -r /usr/share/bash-completion/bash_completion ] && .
/usr/share/bash-completion/bash_completion
#
# ~/.bash_profile
#
[[ -f ~/.extend.bash_profile ]] && . ~/.extend.bash_profile
[[ -f ~/.bashrc ]] && . ~/.bashrc
#
# ~/.extend.bashrc
#
# Change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
PROMPT_COMMAND='echo -ne
"\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
;;
screen*)
PROMPT_COMMAND='echo -ne
"\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
;;
esac
use_color=true
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
else
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\]
\W\[\033[01;32m\]]\$\[\033[00m\] '
fi
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi
unset use_color safe_term match_lhs sh
alias cp="cp -i" # confirm before overwriting
something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias np='nano -w PKGBUILD'
alias more=less
xhost +local:root > /dev/null 2>&1
complete -cf sudo
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
shopt -s expand_aliases
# export QT_SELECT=4
# Enable history appending instead of overwriting. #139609
shopt -s histappend
#
# # ex - archive extractor
# # usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# better yaourt colors
export
YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35"
[toc] | [prev] | [next] | [standalone]
| From | fr314159@gmail.com |
|---|---|
| Date | 2017-05-08 09:59 -0700 |
| Message-ID | <2dce1d30-f5d0-4cc9-bd28-7fb353b49b42@googlegroups.com> |
| In reply to | #413846 |
On Monday, May 8, 2017 at 12:31:31 PM UTC-4, DFS wrote: > > So I have to do Terminal | Set Encoding | > UTF-8, which fixes it, > It would appear that you are using the Gnome terminal, which is part of the GNOME DE and also involves systemd. I know nothing about such a junk set up. It uses an entirely different configuration scheme. Get a REAL GNU/Linux system together and you will NEVER have such ridiculous problems.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.os.linux.advocacy
csiph-web