How can I get bash to read and display eight-bit characters?

How can I get bash to read and display eight-bit characters?


This is a process requiring several steps.

First, you must ensure that the `physical' data path is a full eight
bits. For xterms, for example, the `vt100' resources `eightBitInput'
and `eightBitOutput' should be set to `true'.

Once you have set up an eight-bit path, you must tell the kernel and
tty driver to leave the eighth bit of characters alone when processing
keyboard input. Use `stty' to do this:

stty cs8 -istrip -parenb

For old BSD-style systems, you can use

stty pass8

You may also need

stty even odd

Finally, you need to tell readline that you will be inputting and
displaying eight-bit characters. You use readline variables to do
this. These variables can be set in your .inputrc or using the bash
`bind' builtin. Here's an example using `bind':

bash$ bind 'set convert-meta off'
bash$ bind 'set meta-flag on'
bash$ bind 'set output-meta on'

The `set' commands between the single quotes may also be placed
in ~/.inputrc.



Home FAQ