Subject: Which characters are legal in a string?

From: sla at umbra.ucsc.edu (Steve Allen)
Date: 27 Oct 1992 03:00:15 GMT

I am looking through the NOST 100-0.3b standard document trying to be
very sure about one point:

    Section 5.3.2.1 specifies that a "character string shall be composed
    only of ASCII text."

    Section 6.1 specifies that characters shall be 7-bit ASCII

These specifications do not preclude the existence of unprintable characters
(ASCII 0 through 31 and 127) in a character string.  Is it intended that
unprintable characters be legal?  Are there FITS readers which will be
confounded by unprintables?

A further question might be asked about the reason why 8-bit ASCII is not
allowed, but I would rather defer that until later.
_______________________________________________________________________________
Steve Allen          | That was the equation!         |   sla at lick.ucsc.edu
UCO/Lick Observatory | Existence!...Survival must     | If the UC were opining,
Santa Cruz, CA 95064 | cancel out programming! -- Ruk | it wouldn't tell me.

---

From: cflatter at cv3.CV.NRAO.EDU (Chris Flatters)
Date: Tue, 27 Oct 1992 17:05:01 GMT

>confounded by unprintables?

Many C and C++ based readers will have problems with ASCII 0 in character
strings.  Many FORTRAN readers will also have problems on Unix systems (the
Fortran RTL often uses C standard library functions that attach a special
meaning to character zero).

	Chris Flatters
	cflatter at nrao.edu

---

From: hanisch at stsci.edu (Bob Hanisch, ST ScI)
Date: Tue, 27 Oct 1992 17:47:57 GMT

>confounded by unprintables?

If you look on p. 5 of the same document, "ASCII text" is defined as ASCII
characters in the range of hex 20 to 7E.  This was done in order to have to
avoid repeating this every time we wanted to refer to printable ASCII text.

So the statement does NOT allow unprintable characters.

The distinction is further clarified in Appendix E (pp. 63-43).

---
Robert J. Hanisch                       Tel. (410)338-4910   Fax. (410)338-5090
Space Telescope Science Institute       NSI: hanisch at stsci.edu [130.167.1.2]
3700 San Martin Drive                   DECNet: STSCIC::HANISCH [6549::] 
Baltimore, MD  21218  USA               Bitnet: hanisch at stsci

---

From: thompson at stars.gsfc.nasa.gov (William Thompson, code 682.1, x2040)
Date: Tue, 27 Oct 1992 14:40:00 GMT

In article <1cibc0INNpjq at darkstar.UCSC.EDU>, sla at umbra.ucsc.edu (Steve Allen) writes...
>confounded by unprintables?

I've always gone by the philosophy that only ordinary printable characters
should appear in a FITS header.  For instance, my software will expand tab
characters out to the appropriate number of spaces before writing it into the
header.

One might argue that more leniency could be permitted in ASCII fields in FITS
binary tables.

>allowed, but I would rather defer that until later.

That's simple:  8-bit ASCII isn't really a standard, is it?  You get different
characters on different machines.

Bill Thompson

---

From: bschlesinger at nssdca.gsfc.nasa.gov (Barry Schlesinger)
Date: Tue, 27 Oct 1992 21:00:00 GMT

>    Section 5.3.2.1 specifies that a "character string shall be composed
This section is referring to values of header keywords.

>    Section 6.1 specifies that characters shall be 7-bit ASCII

This section refers to data

>confounded by unprintables?

In Section 3, the term ASCII text is defined to mean "ASCII characters
hexadecimal 20-7E" (decimal 32-127) for the NOST standard.  These
characters are the printable ASCII characters.  Section 4.2 states
"The primary HDU and every extension HDU shall consist of an integral
number of header records consisting of ASCII text, which may be
followed by an integral number of data records."  Thus ASCII decimal
0-31,127 are excluded from headers.  The specification for character
data does not restrict the permitted characters.  Specifications for
individual structures may.  For example, for ASCII Tables, 8.1.5 reads
"All data in an ASCII tables extension data record shall be ASCII
text...."  A restriction to printable ASCII characters and 
NULL (decimal and hexadecimal zero) is proposed for binary tables. 

					Barry Schlesinger
					NOST FITS Support Office