Talk:Terminal control/Unicode output

From Rosetta Code
Revision as of 15:48, 12 September 2011 by rosettacode>Markhobley (My internet connect keeps dropping in storm. I hope this works)

Unix shell embedding Awk?

Surely you can check an environment variables value in the shell, without the need to call Awk. As it stands, it doesn't seem to be a good example of using the Unix shell. --Paddy3118 07:59, 11 September 2011 (UTC)

We cannot check for substrings on a Bourne shell, so we have to use AWK. Other shell implementation may not need to do this of course. Markhobley 08:02, 11 September 2011 (UTC)
Actually, it looks like you can match substrings by using the switch command. If this works I will try and rewrite this to get rid of awk. Markhobley 08:20, 11 September 2011 (UTC)
Thanks Mark. --Paddy3118 16:05, 11 September 2011 (UTC)

Er, "Terminal supports"?

I can run xterm +u8 with UTF-8 locale, and both current awk and shell solutions output garbage. What does it mean, "terminal supports unicode"?

Terminal supports unicode means that the terminal supports Unicode output. Not all terminals can do this.

The ZX spectrum basic solution doesn't even make sense: can you display more than 256 different characters on screen at once? If not, what good is this "unicode support"? --Ledrug 03:12, 12 September 2011 (UTC)
Yes, the ZX Spectrum can display more than 256 different characters at once. You need to define some switching code though, and you are limited to about 40k usable memory,but that is more than enough to fill the screen. You can even reference the symbol numbers using the listed Unicode symbols, but you would need to code this. The ZX Spectrum was a versatile little machine. FWIW, I used an alternative character set called M5C (one of my own inventions), which I also implemented on IBM compatible computers. This used a 5 bit character set with page switching, and supported many different characters. I will eventually expand and publish updated specifications (because my notes were only partially complete. There are still unused pages that could be implemented. I only implemented what was needed at the time, and the unused pages left room for expansion.)

Yeah, the printf may not work on some systems. I am working on some Unicode compatible helper programs which will be guaranteed to produce the appropriate Unicode output from shell scripts, etc. This in on my todo list.

There are some other problems with the Unix shell solution. It uses a non-portable construct "set --" instead of "unset". I will try to find why this construct was used instead of "unset" (which is more portable). Maybe we need two versions here. I am investigating this. Markhobley 15:48, 12 September 2011 (UTC)