LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 10-01-2009, 03:29 PM   #1
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-15 with Cinnamon & KDE
Posts: 1,272
Blog Entries: 3

Rep: Reputation: 86
terminal and konsole windows show strange characters


When I open a terminal or konsole window, output (either STDOUT or STDERR) sometimes contains funny characters instead of something meaningful. Can someone explain how I might correct this situation?

ANALYSIS:
One very repeatable example involves using the manual page command
Code:
man set

... man page output ...
upstart - event-based init daemon

In my copy of the output, there are several problems in the very first screen. In the synopsis section, there is "{ value | ?value? ..."
Replace the '?' with a lower-case-a-under-a-carat character (a-hat).
I suspect the garble character might be apostrophe in real life.

In other places, I see var?/able or how?/ever or trans?/action where
the '?' is again a-hat and the '/' represents end of line or newline.
I suspect the garble character might be a hyphen in real life.

All of this suggests that there is a conflict between the character stream written to STDOUT by the man command and the character-display settings (is that "code page" or similar?) of the specific terminal or konsole in use.

In specific, I use konsole v1.6.6 from KDE v3.5.10. In general, I'm
running Ubuntu Hardy (v8.04.3 LTS).

Thanks,
~~~ 0;-Dan
 
Old 10-01-2009, 10:01 PM   #2
epilitimus
LQ Newbie
 
Registered: Jul 2009
Distribution: Slackware
Posts: 28

Rep: Reputation: 17
Is this a recent problem? Does it happen from the kernel console? Does the keyboard render the correct characters? Does it happen everytime, or just occasionally?

You can use xmodmap to see the current translation tables. Another possibility is that your terminal program is not properly interpreting the console control codes.
 
Old 10-02-2009, 12:49 PM   #3
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-15 with Cinnamon & KDE
Posts: 1,272
Blog Entries: 3

Original Poster
Rep: Reputation: 86
here is more detail

A getty console ( ctrl-alt-Fn ) shows the apostrophe and hypen instead of the a-hat.

When I run xmodmap here are the results:
Code:
user@host:~$ xmodmap
xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x6d)
mod1        Alt_L (0x40),  Alt_R (0x71),  Meta_L (0x9c)
mod2        Num_Lock (0x4d)
mod3
mod4        Super_L (0x7f),  Hyper_L (0x80)
mod5        Mode_switch (0x5d),  ISO_Level3_Shift (0x7c)
This does not shed any light on the a-hat garble -- at least not for me.

I also get the following: (edited for readability)
Code:
user@host:~$ stty --all

speed 38400 baud; rows 40; columns 90; line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany -imaxbel -iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
On the getty-console, xmodmap does not apply but I get the following details:
Code:
user@host:~$ stty --all

speed 38400 baud; rows 48; columns 128; line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff
-iuclc -ixany -imaxbel -iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
I will need to sift through to explain the differences. (blush) It has been a lot of years since I played termcap/terminfo games.

~~~ 0;-Dan

Last edited by SaintDanBert; 10-02-2009 at 01:23 PM. Reason: add more details
 
Old 10-02-2009, 04:56 PM   #4
epilitimus
LQ Newbie
 
Registered: Jul 2009
Distribution: Slackware
Posts: 28

Rep: Reputation: 17
The reason for checking the getty console was to see if it was a problem above or below the kernel/X boundary. Since it works fine from a kernel level console the problem has to be X or above.

The keycode translation tables for X can be viewed with "xmodmap -pk" check where the apostrophe and hyphen are listed. On my machine they are at 48 and 20 (as "minus") respectively. They may be different on you machine. Since X reads the keyboard in raw mode and does it's own translations the termcap/getty settings aren't really important.

Also on a Konsole window you can set the character encoding under the Settings/Encoding menu. Try the various options and see if that fixes it.
 
Old 10-02-2009, 05:18 PM   #5
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-15 with Cinnamon & KDE
Posts: 1,272
Blog Entries: 3

Original Poster
Rep: Reputation: 86
Quote:
Originally Posted by epilitimus View Post

The keycode translation tables for X can be viewed with "xmodmap -pk" check where the apostrophe and hyphen are listed. On my machine they are at 48 and 20 (as "minus") respectively. They may be different on you machine. Since X reads the keyboard in raw mode and does it's own translations the termcap/getty settings aren't really important.
What I get from xmodmap -pk is:
Code:
     20    	0x002d (minus)	        0x005f (underscore)	

     48    	0x0027 (apostrophe)	0x0022 (quotedbl)
This feels very much like a "smart quotes" problem in some word processing software. In that situation, one sees the opening double-quote with a top-dot and left curl. Later one sees the closing double-quote with a right curl and bottom-dot. The data on file is different from whatever one sees on screen or print and filter software sees junk instead of "double-quote".

I will play with the menu-options values within konsole and see what happens. Now where is my VT100 escape code manual...

when I looked at Menu->Settings->Encoding
Code:
Western European 8859-1
I have the option to select Default whatever that might be.

I have the option to select various UTF xxxx options. I tried UTF8 and the a-hat problem resolved.

QUESTION: Does this tell me that
Code:
man something  # implies man | less
generates UTF8 output? How would I know? How am I supposed to know which other programs expect some other output format?

QUESTION: How do I set this and make it sticky for any use of 'konsole'? of other 'terminal' or 'x-term'?

Thanks, again,
~~~ 0;-Dan
~~~ 8d;-Dan

Last edited by SaintDanBert; 10-02-2009 at 05:27 PM. Reason: adding details, clarification, more questions
 
Old 10-02-2009, 05:46 PM   #6
epilitimus
LQ Newbie
 
Registered: Jul 2009
Distribution: Slackware
Posts: 28

Rep: Reputation: 17
I just leave the encoding on mine set to "default", I suppose I could plow through documentation to see where it detirmines what the "default" encoding is...does X have a default encoding in the confguration file, hmmm, not sure...but it works so why bother

man et. al. are console based programs so I believe they are going to use the "TERM" environment variable to figure out how to do any formatting/special characters. My system has the TERM variable set to "xterm", not really sure what the other options are...again it works as is so why beat my head against that particular wall as well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminal Transparency to show underlying windows dauphinfay Linux - Desktop 3 08-14-2008 03:22 PM
After running my program, it fails and gives my terminal strange characters that I ca RHLinuxGUY Programming 4 08-31-2006 04:24 AM
Alternative terminal to konsole & gnome-terminal Adony Linux - Software 3 10-08-2004 03:59 AM
Strange characters in Konsole under Redhat 8.0... lonestarbacon Linux - Distributions 15 07-09-2003 02:57 PM


All times are GMT -5. The time now is 05:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration