You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opening this issue about non-ASCII (e.g. UTF-8) characters in FITS header, which is a quite common issue with many duplicates (if I'm not mistaken), but I cannot find an issue to gather all (related: #2887#5732#5396#3497). #2887 has a test file, other test files are welcome.
This is not standard but it should be possible to display these headers and to allow fixing them. Quoting @embray (#2887 (comment)):
It's probably a relatively easy fix. If nothing else the header parser needs to catch non-ASCII bytes and either replace them with a replacement character (e.g. '?' and/or raise an error--perhaps depending on a setting).
The primary HDU and every extension HDU shall consist of one or more 2880-byte header blocks immediately followed by an optional sequence of associated 2880-byte data blocks. The header blocks shall contain only the restricted set of ASCII text characters, decimal 32 through 126 (hexadecimal 20 through 7E). The ASCII control characters with decimal values less than 32 (including the null, tab, carriage return, and line feed charac- ters), and the delete character (decimal 127 or hexadecimal 7F) must not appear anywhere within a header block.
In section 3.3.2 of the same document, it says:
The last header block must contain the END keyword (defined in Sect. 4.4.1) which marks the logical end of the header. Keyword records without information (e.g., following the END keyword) shall be filled with ASCII spaces (decimal 32 or hexadecimal 20).
I do not think that astropy should be facilitating use of non-standard FITS files.
@mcara - Thanks for the file. About "facilitating use of non-standard FITS files", the goal here is not to allow writing non-standard FITS files, but just to read them, to be able to fix the problematic cards.
Activity
mcara commentedon May 16, 2017
#5093 seems to be somewhat related to this issue too (though for header padding I think parser could safely ignore non ASCII characters).
saimn commentedon May 16, 2017
@mcara - Indeed. Do you still have the problematic files ?
Handle non-ASCII characters in FITS header
mcara commentedon May 17, 2017
@saimn https://stsci.box.com/s/v2szxbpazaxu2y4f2h7et9wkykmghw5h (link set to expire on August 31st, 2017).
In my opinion non-ASCII characters should not be supported. From the section 3.2 of https://fits.gsfc.nasa.gov/standard40/fits_standard40draft1.pdf:
In section 3.3.2 of the same document, it says:
I do not think that
astropyshould be facilitating use of non-standard FITS files.saimn commentedon May 17, 2017
@mcara - Thanks for the file. About "facilitating use of non-standard FITS files", the goal here is not to allow writing non-standard FITS files, but just to read them, to be able to fix the problematic cards.