Operating System - Linux
1753643 Members
5482 Online
108798 Solutions
New Discussion юеВ

Does this short shell script entry affect French char display?

 
SOLVED
Go to solution
Debbie Fleith
Regular Advisor

Does this short shell script entry affect French char display?

We are having a problem with a script (which I didn't write) that exports French data from a 4GL db on an HP-11 server.

Can someone tell me in words what this does and if it would affect the data from having the correct French accents in the output file created in the script?

====
if [ -t 0 ]
then
stty erase '^h' echoe intr kill '^x'
fi
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Does this short shell script entry affect French char display?

No, that line simply determines if stdin (file descriptor 0) is a TTY (terminal or terminal-like) device and, if so, resets the interrupt and kill characters. The idea is that it makes no sense to set these things if stdin is, for example, a pipe. This is a rather standard UNIX idiom.

The appearance of characters displayed is really determined by the current character set of the display device (terminal, terminal emulator, printer). All the computer does is send, for example, decimal 65 encoded (usually) as 8 bits of data, the display device then looks up 65 in a table an outputs, for example, the character 'A'.
If it ain't broke, I can fix that.
Peter Godron
Honored Contributor

Re: Does this short shell script entry affect French char display?

Debbie,
I believe A. Clay Stephenson has addressed the UNIX side of the problem. Focus show now turn to the export/reporting side of the 4GL db and the way the data is imported or displayed. If your terminal is not set up correctly, accented characters can cause problems. What is the 4GL? How are you exporting/reporting the data? How is the data displayed ? Are you seeing 'weird' characters?
Debbie Fleith
Regular Advisor

Re: Does this short shell script entry affect French char display?

Thanks,

If this script is run from cron, and there is a TERM=vt100;export TERM entry in the script too, how is the current character set of the display device determined, since there really is no display device on an automated job?
A. Clay Stephenson
Acclaimed Contributor

Re: Does this short shell script entry affect French char display?

You still haven't quite made the connection. The TERM setting has little to do with this although one can query the terminfo to see if "smacs" (start alternate character set) is defined; "rmacs" does the reverse but all this could do in a batch job would be to embed the commands in the output stream that would enable the alternate character set for one type of device (e.g. vt100). If you sent this file to another device (e.g. a printer or a different terminal emulator) then if the characters displayed as desired it would be by accident.

This is much easier in the PC world where the CODEPAGE can be selected. In my previous example, where decimal 65 is sent depending upon the CODEPAGE setting 'A','*','}', or whatever might be displayed.

You need to select the character set on your output device because the data in your batchfile will remain constant.

Do a Google search on Unicode and CODEPAGE and you will get a better understanding.
If it ain't broke, I can fix that.
Mike Stroyan
Honored Contributor

Re: Does this short shell script entry affect French char display?

The important factor in the handling of international characters is the locale. That can be controlled by setting the LANG environment variable or by setting more selective LC_* environment variables as described by
http://www.docs.hp.com./en/B2355-60103/locale.1.html

The default locale for cron jobs is "C", as documented in
http://www.docs.hp.com./en/B2355-60103/crontab.1.html
You will need to set the locale environment variables in each cronjob that needs some other locale.