[Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!
adamnt42 at ...626...
adamnt42 at ...626...
Wed Dec 30 01:15:16 CET 2015
On Tue, 29 Dec 2015 16:54:29 +0100
Fabien Bodard <gambas.fr at ...626...> wrote:
> To resume ... in the old past of ascii all standart printer or monitor
> can manage ascii and print 32 to 127 chars. So Ansi C provide a
> standart function named IsPrint that allow to say if a char was able
> to be printed.
>
> IN 2015... Ascii is known in it's 8 bit format so printable chars are
> from 32 to 255.
>
> Characters lower than 32 are for monitor, modem and printer management.
>
> Thanks to my terminal studie i'm now able to understand all of that :-).
>
> It's really interresting to study the past ...
Having been part of that "past" (and I hope that doesn't mean you are going to "study" me...) let me expand your knowledge a bit (I hope).
Long ago and far far away, there were only three (or four) ways to "permanently" store data, on paper tape, on magnetic tape, on punch cards or perhaps on paper. The latter being the only medium, that which we called "wetware" (humans), could readily understand. Each computer manufacturer used their own codification for the data they stored. Hence we had such wonderful things as EBCDIC, Baudot and CDCcode. Which was fine as long as the customer bought their entire gear from one company, e.g. IBM, CDC, Univac etc. Then along came a thing called the Kennedy tape drive. This drive you have seen on old sci-fi movies, they were (originally) about 6 foot tall and have two spools that seem to oscillate in their rotations. Here is a couple of pictures, the first to jog your grandfather's memory of the computer's greatest era and the second to explain the following.
http://images.spaceref.com/news/loirp/196704_6.l.highlight.jpg
https://en.wikipedia.org/wiki/File:IBM_System_360_tape_drives.jpg
What was magical about those drives were the two long vertical gray "bars" below the middle blue panel. These were vacuum "tubes" that enclosed loops of tape "loosened" from the two spools. Why? Because, since most tape operations in those days involved repeated access to the same area of a particular spool, this allowed the capstan that moved the tape to and fro across the read and write/erase heads to move at a much faster speed than the tape could be reeled on and off the spools, Hence that backwards and forwards movement of the spools seen in the old movies.
The other "magical" aspect of the Kennedy drives is that they were incorporated in the hardware of different computer manufacturers. This resulted in a need for a (or at least several) "standard" data encoding mechanism(s).
To cut a (very) long story short along came ASCII. Or to be very specific the 7-bit variant thereof. Why 7 bit? Because 2^7 = 128 and that, then was considered the efficient length for data encoding that could be passed across a modem between two devices. Thus we get the lower 32 (IMHO) badly named "control characters" and the 96 very, very badly named "printable characters"!
Why the latter? Because char(128) is NOT printable on a mechanical printer, not one manufactured to my recollection could actually delete (DEL) the previous character! They did not have erasers. Also, many (ahem) printing devices of that day did "different" things when you send them a DEL.
In the former case, to my mind, some of these "control characters" are (were) actually "printable". Notably the char(7) "BEL" character which caused the "printer" to sound an actual bell or (if they were the "fancy" ones a "BEEP". Others are the char(9) through char(13) set, i.e. HT, LF, VT, FF and CR characters. These made the "printer" do something and if you think about it those "somethings" are not dissimilar to what they did with a char(32), the infamously unnamed SPC character. They all "printed" white space, aka "nothing" for a specific length of character spaces. (Aside: One of the peculiar skills computer professionals of that era had was the recognition of those "nothings"!)
Of the other supposed "control characters" they actually had two (in fact several) general purposes. Firstly, some of them actually "controlled" the communication between the sending and receiving devices. These were STX, ETX, EOT, ENQ, ACK, DLE, DC1-4, NAK, SYN, ETB. Thank the gods for these, otherwise we would not have the TCP stack.
Secondly, some were specific data "items": SOH, FS, GS, RS and US and the dreaded EOM! (Aaargh no more tape!). These were particularly useful for serially encoded data (and what we now call data streams). The others had some generally arcane meanings but proved useful anyway: SO, SI, DLE, CAN, SUB and to some extent ESC. When I say useful I mean someone somewhere must have needed them - I can't say I ever did.
This (unless I have forgotten any) leaves the notorious NUL character - which from my memory never actually did anything at all (but was handy if you wanted to send some sort of "hang in there bozo" message to the receiver).
Now, to get back to a bit of hardware. The first (professional) job of my career entailed programming the famous (but rotten) PDP 11-20 computer to do mathematical "stuff"... in assembler. The one we had was a single user, single run machine. By that I mean you wrote your program ... and I mean wrote as in pen and paper ... then manually punched it on to paper tape, loaded the paper tape into the paper tape reader/writer and started the computer (and I mean bootstrapped it via the from panel to read your paper tape) and then pressed GO.
After it did all the fancy calculations you had a PAUSE instruction that let you take your program tape out and put in a blank tape that punched out the answers. Weeeeeellll. It actually punched out the "coded" program for the teletype printer... if you were lucky (and pretty damn clever, if I say so myself) the teletype would actually print out the answer on paper so that the "client" could read it.
Then one day, the gods delivered unto us a brand new beautiful pink and purple thing called a PDP 11-40 - a thing of great beauty and a joy forever. On it, or more specifically on it's 12MB "high speed" hard disk drive was a bootable executive program that I will hesitantly grace with the name "operating system". (Thankfully I have forgotten its damn name!)
It still could only run one "program" at a time but it did have some things that made it to me one of the best two ("big" - it was about 5 foot high and 10 foot across) computers I have ever worked on. To describe it. It's console was a teletype, but the main use of that device was to issue commands to the "executive". It had a Kennedy tape drive, a late model version that was sooooo fast!
A paper tape reader/punch that had vacuum tubes like the tape drive that meant you couldn't even have one sip of coffee before it loaded your program.
It had an "integrated line printer" that meant you could print your results out without having to walk across the room.
If you wanted to run your program more than once, gasp, you could store it on the "hard disk" and invoke it (from the teletype) without having to search through hundreds of paper tapes to find the one you wanted! AND! it had a CRT display, in fact a thing called a VT05! AND, AND AND (be still my racing heart!) it had a high level programming language .... wait for it .....
BASIC PLUS 2
(See it here ... https://en.wikipedia.org/wiki/BASIC-PLUS)
the rest is much, much , too much history.
In case I don't get back, have a wonderful new year.
cheers
bruce
>
> 2015-12-29 16:39 GMT+01:00 Fabien Bodard <gambas.fr at ...626...>:
> > But is print just take into account the old asci table
> >
> >
> > 2015-12-29 16:35 GMT+01:00 ML <d4t4full at ...626...>:
> >> All,
> >>
> >> I might be utterly wrong, but since Linux normally uses UTF-8, any
> >> high-bit-set char may be interpreted as one of the "multibyte char" flags.
> >> If isprint() takes this into account, then it's dead right that char by
> >> itself is not printable!
> >>
> >> Hope that helps and makes sense...
> >>
> >> On 2015-12-29 11:53, Ru Vuott wrote:
> >>> Tchao Fabien,
> >>> Ru .. Characters > to 127 are printable...
> >>> uhmmm... excuse me, but I do not understand.
> >>> If I test the "printability" :-) of "characters > to 127" by using C "isprint()" function (that checks whether the passed character is printable), I obtain only zero results.
> >>> Where: "isprint()" function returns a non-zero value (true) if character is printable, else zero (false) if character is NOT printable.
> >>>
> >>> *****************************************************
> >>> #include <stdio.h>
> >>> int main() {
> >>> int i, c;
> >>> for (i=128; i <= 255; ++i) {
> >>> c = isprint(i);
> >>> printf("%d %d\n", i, c);
> >>> }
> >>> return (0);
> >>> }
> >>> *****************************************************
> >>> So, it seems resulting that "characters > to 127" are NOT printable characters.
> >>> Ciao
> >>
> >> ------------------------------------------------------------------------------
> >> _______________________________________________
> >> Gambas-user mailing list
> >> Gambas-user at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> >
> >
> > --
> > Fabien Bodard
>
>
>
> --
> Fabien Bodard
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
--
B Bruen <adamnt42 at ...3379... (sort of)>
More information about the User
mailing list