General
cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong character mapping in console mode

Wrong character mapping in console mode

Hi all,

I have an HP workstation working under HP-UX 11.11. The keyboard layout ist set to USB_PS2_DIN_German_Euro

Wenn I log in in console mode, the TERM variable is set to 'hp'. Unfortunately, some characters don't appear as they should be.

Especially annoying is the minus character. It actually works like a minus (-) but appears on the screen like a caret (^).

Also as I'm using the tcsh, the arrow keys should allow me to scroll through the history but they don't work at all.

Thanks.
13 REPLIES
Matti_Kurkela
Honored Contributor

Re: Wrong character mapping in console mode

> Especially annoying is the minus character. It actually works like a minus (-) but appears on the screen like a caret (^).

This is very strange, as both minus and caret are part of the basic 7-bit ASCII character set, which is unchanged in most 8-bit character sets.

If the minus sign actually appears like a caret, the problem might be that the font used on the display uses a different character encoding than the keyboard layout. But I don't know any character set which would make such a deviation in the basic ASCII set.

Could you please run the following commands and tell us what is the output in each case?

expr 2 ^ 3

expr 2 - 3

> Also as I'm using the tcsh, the arrow keys should allow me to scroll through the history but they don't work at all.

tcsh is not part of standard HP-UX 11.11, so it's probably been installed from a third-party source. Perhaps the packager did not modify the shell's defaults to include the HP arrow key definitions?

The standard tcsh has a built-in mapping for ANSI/vt100-style arrow keys. This includes xterm, so in X11 environment the arrow keys will work automatically. As vt100 is one of the most common terminal emulations, it is likely that the arrow keys will work on most common remote connections too. But the HP terminals' arrow key definitions are not built in.

By default, tcsh does not use TERM, but the older TERMCAP variable. The TERMCAP variable should include the entire terminal feature description, not just the name of the terminal. If you use tcsh and that version has not been extensively modified to use the terminfo library instead of termcap, you probably should add some commands to your login scripts to populate the TERMCAP variable, as HP-UX does not do it by default.

If TERMCAP is populated correctly, tcsh should automatically get the terminal-type-specific arrow key mappings from it. Failing that, the "bindkey" command could be used to explicitly force the key mappings.

MK
MK

Re: Wrong character mapping in console mode

> Could you please run the following commands and tell us what is the output in each case?
> expr 2 ^ 3
> expr 2 - 3

Both produce 2^3 as output.


> If TERMCAP is populated correctly, tcsh should automatically get the terminal-type-specific arrow key mappings from it

OK, interesting hint. I will delve somewhat into TERMCAP.

Re: Wrong character mapping in console mode

> If the minus sign actually appears like a caret, the problem might be that the font used on the display uses a different character encoding than the keyboard layout. But I don't know any character set which would make such a deviation in the basic ASCII set.

How can I find out which font and which encoding is beeing used?

Matti_Kurkela
Honored Contributor

Re: Wrong character mapping in console mode

>> expr 2 ^ 3
>> expr 2 - 3

>Both produce 2^3 as output.

Sorry, I should have mentioned that all the spaces are essential.

If entered exactly as I wrote them, with spaces separating each character after "expr", one of these should output "-1" and the other "expr: syntax error". The question is, which one?

> How can I find out which font and which encoding is beeing used?

It's been too long since I seriously worked with HP-UX _workstations_... but as you said you're logging in console mode (aka Internal Terminal Emulator, or ITE), the name of the font is probably known only by the hardware/firmware developers.

In ITE, if my hazy memory is correct, the (default) character encoding is HP Roman8. That would not explain the discrepancy between the caret and the minus sign: in that character set, both of those characters conform to standard ASCII.

But if you're using the console in GUI mode, the character set can be selected in the login dialog. If you choose a non-default language and/or character set when logging in, your choice will automatically be remembered the next time you log in.

MK
MK

Re: Wrong character mapping in console mode

> Sorry, I should have mentioned that all the spaces are essential.

>If entered exactly as I wrote them, with spaces separating each character after "expr", one of these should output "-1" and the other "expr: syntax error". The question is, which one?

*) If I type in: expr 2 ^ 3 (with the caret key), the output is:

hostname:> expr 2 ^ 3
expr: Syntax error

*) If I type in: expr 2 - 3 (with the minus key), the output is:

hostname:> expr 2 ^ 3
^1


Hope this helps.
Dennis Handly
Acclaimed Contributor

Re: Wrong character mapping in console mode

>*) If I type in: expr 2 ^ 3: expr: Syntax error
>*) If I type in: expr 2 - 3: hostname:> expr 2 ^ 3: ^1

Hmm, so two different inputs produce the same char on the screen but they are different.

So these would show the same char (^) but different hex values:
echo "-" | xd -tx1 -tc
echo "^" | xd -tx1 -tc

Re: Wrong character mapping in console mode

>So these would show the same char (^) but different hex values:
>echo "-" | xd -tx1 -tc
>echo "^" | xd -tx1 -tc

OK, this was a bit complicated to test because it appeared that the pipe character doesn't work. So from a remote host I put the 2 commands in a script and then ran it on the local console.

This is the result:

*) with the minus key:
0000000 2d a
^ Zn
0000002

*) with the caret key:
0000000 5e a
^ Zn
0000002


As you can see, the backslash (\) is also affected as it appears on the screen as "Z"


Re: Wrong character mapping in console mode

I meanwhile found out that the above behaviour only occurs if the keyboard layout is set to something other than US_English.

With US_English layout, the appearance on the screen correlates with the keys. With German or French e.g., a few keys show differently on the screen but are interpreted correctly as typed in.

Could this be some locale or language bug? Is there maybe a patch for it?

Regards

Re: Wrong character mapping in console mode

Hello,

no reaction for more than 10 days. The problem still exists. Does really no one have an an idea about my 2 previous postings.

Regards
Matti_Kurkela
Honored Contributor

Re: Wrong character mapping in console mode

(Sorry about the late answer; I forgot to check this thread again after Easter holidays.)

According to the ASCII table, 2D is the correct hex value for the minus sign, and 5E for the caret. So the keyboard input side seems to work OK and the problem should be somewhere in the output path.

Can you please list more of the non-functional characters? Perhaps there is a pattern of some sort.

I would still like some more details about "console mode". Because the keyboard selection affects the problem, this does not seem to be simply a stty settings problem. But it might be useful to check that too: could you please run "stty -a > settings.txt" or something similar and attach the output to this thread?

Based on what you've said previously, I think you've disabled the graphic user interface (CDE) and are using the Internal Terminal Emulator. Am I right? Please confirm or correct me here; misunderstanding this detail would be severely misleading.

The ITE text mode would be mostly a product of firmware, so knowing the model of your system (and the display controller, if your workstation uses anything other than the default built-in one) would be important.

Do you see a row of 8 squares at the bottom of your screen? (If you don't, try pressing each of the function keys F1-F10 and see if anything happens.)

These would be the labels for the function keys: the ITE emulates a serial-attached HP terminal, and a real HP terminal can be configured (locally at the terminal side) using the function keys. The OS would have to have the correct stty settings to match the local settings of the terminal. With a real terminal, mismatched settings between the terminal and the OS could lead to various problems... but I just don't remember how much of these settings are available in the ITE.

The only other thing that might affect to the ITE is the console path setting. It is adjustable in the boot prompts. Unfortunately I cannot give you exact instructions for checking the console path without knowing the model of your workstation: there are some significant differences between models.

This might help some in finding out the console path setting:
http://www.pateam.org/parisc-linux-boot/PA-RISC-Linux-Boot-HOWTO/consoles.html

MK
MK

Re: Wrong character mapping in console mode

Hello Matti,

> Can you please list more of the non-functional characters? Perhaps there is a pattern of some sort.

Here are some more:

key pressed -------> screen output

# ---> ;
\ ---> Z
@ ---> =
| ---> N
paragraph sign ---> =
sharp s ---> ^
u umlaut ---> O
o umlaut ---> N
a umlaut ---> L


> could you please run "stty -a

Here is the output:

speed 9600 baud; line = 0;
rows = 0; columns = 0
min = 4; time = 255;
intr = ^C; quit = ^Z; erase = DEL; kill = ^U
eof = ^D; eol ; eol2 ; swtch = ^=
stop = ^S; start = ^Q; susp = ^Z; dsusp
werase = ^W; lnext = ^V
^parenb ^parodd cs8 ^cstopb hupcl cread clocal ^loblk ^crts
^ignbrk brkint ignpar ^parmrk ^inpck ^istrip ^inlcr ^igncr icrnl ^iuclc
^ixon ^ixany ^ixoff ^imaxbel ^rtsxoff ^ctsxon ^ienqak
isig icanon iexten ^xcase echo echoe echok ^echonl ^noflsh
echoctl ^echoprt ^echoke ^flusho ^pendin
opost ^olcuc onlcr ^ocrnl ^onocr ^onlret ^ofill ^ofdel ^tostop tab3


> Based on what you've said previously, I think you've disabled the graphic user interface (CDE) and are using the Internal Terminal Emulator. Am I right?

Yes


> knowing the model of your system...

The workstation is a 9000/785/C8000 running under HP-UX 11.11. It is connected to a monitor LP2475w


> Do you see a row of 8 squares at the bottom of your screen?

Yes. the 8 yellow squares are there. Only three of them are labeled:
F4: Remote Mode
F7: Display Functns
F8: Auto LF


miderose
Occasional Visitor

Re: Wrong character mapping in console mode

I had same problem (but when I pressed '-' I saw 'ì'). I solved in this way:

in SingleUserMode:

NUM-LOCK

(now the label on the yellow squares on your screen will change)

F8 - config keys
F5 - terminal config
press TAB until you are on ASCII 8 Bits (you have to press it 5 times)
F2 - NEXT CHOICE (ASCII 8 Bits must be YES)
F1 - SAVE CONFIG

have fun ;)

make me know if it works...
Eric Antunes
Honored Contributor

Re: Wrong character mapping in console mode

This Num-Lock key worked fine for me when a "F1 T LABEL ..." screen appeared on the concole.
Each and every day is a good day to learn.