Operating System - HP-UX
1823941 Members
3731 Online
109667 Solutions
New Discussion

Registered Symbol in Korn Shell script

 
Hunki
Super Advisor

Registered Symbol in Korn Shell script

When I am trying to write this symbol in shell script ( ® ) I am getting a . ( dot ) instead , does anybody know how to fix it.

Thanks.
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: Registered Symbol in Korn Shell script

There is nothing to fix. How a given octet (byte) or group of octets is actually displayed is solely a function of the output device (terminal, terminal emulator, printer,
plotter, ...). You have to study the documentation for the device to see how to select the optional character set. The host computer is simply going to send the octet , whether that octet outputs 'A', '@', or 'a' depends upon the display device itself.

What you do not want to do is hard-code character sequences in your script or application. You should user the terminfo database entry corresponding to your TERM setting. In shell scripts this is done using the tput command. For example, your shell script MIGHT use
tput scs 2
to select a character set.
Man terminfo, tput for details.
If it ain't broke, I can fix that.
Olivier Masse
Honored Contributor

Re: Registered Symbol in Korn Shell script

Personally I'd write (r) instead. Putting special characters like this one is bound for trouble. If anybody runs your script with a different terminal, terminal setting, locale, etc. there are chances that the output of such a character will be garbled.
Dennis Handly
Acclaimed Contributor

Re: Registered Symbol in Korn Shell script

>Olivier: Personally I'd write (r) instead.

Our HP lawyers said that (c) wasn't good enough. You could do that but you had to spell copyright out. Of course fancy documents and web pages would use those symbols.
Peter Nikitka
Honored Contributor

Re: Registered Symbol in Korn Shell script

Hi,

the following settings permit that, but really don't ignore ACS's posting!
- stty should NOT report 'istrip' but '-istrip' ans cs8:
ef3nip00@forth[94] stty -a
speed 9600 baud;
rows = 52; columns = 126; ypixels = 790; xpixels = 1144;
csdata ?
eucw 1:0:0:0, scrw 1:0:0:0
intr = ^c; quit = ^\; erase = ^h; kill = ^u;
eof = ^d; eol = ; eol2 = ; swtch = ;
start = ^q; stop = ^s; susp = ^z; dsusp = ^y;
rprnt = ^r; flush = ^o; werase = ^w; lnext = ^v;
-parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crtscts -crtsxoff -parext
...

- your locale setting should reflect the code set:
ef3nip00@forth[95] locale
LANG=en_US.ISO8859-1
LC_CTYPE=en_US.ISO8859-1
LC_NUMERIC=en_US.ISO8859-1
LC_TIME=en_US.ISO8859-1
LC_COLLATE=en_US.ISO8859-1
LC_MONETARY=en_US.ISO8859-1
LC_MESSAGES=C
LC_ALL=

- the key sequence Compose-o-c will produce the copyright sign which is correctly printed (maybe not visible here):
ef3nip00@forth[96] print -n ©| od -cx
0000000 ©
a900
0000002

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"