On Thu, 6 Oct 2016, Riccardo (Jack) Lucchetti wrote:
On Thu, 6 Oct 2016, Leandro Zipitria wrote:
> Dear all,
> I have just save a database (attached) in Gretl native format
> (gdt). When trying to open it again, the program say "Could not
> open ... file". Please find attached the file.
> I am working under Fedora Linux, using Gretl 2016c. I open the
> original database, save it as a gdt file and try to open it again
> and find the same error.
Apparently, the value labels for your variables "Area_A" and "P36"
contain a few non-UTF8 characters.
Since it looks as if you imported these data from an SPSS file,
could you please check what happens with the value labels in both
Here's my diagnosis, having taken a close look at the original SPSS
data file which Leandro imported, and the gdt file produced by
First, the SPSS file contains quite a lot of strings -- labels for
variables and also labels for values -- and these are represented in
a mash-up of incompatible and/or broken encodings. There's really
nothing gretl can do to repair such strings.
However, it turns out that the reason why gretl was unable to read
the data back from the saved gdt was a bit different. Despite the
encoding mash-up in the source SPSS file, gretl's importer ensured
that everything in the gdt file was in fact valid UTF-8, albeit not
being valid text in any human language!
Case in point: the proper Spanish for "San Jose" replaces the final
plain "e" with an e-acute. In some instances in the SPSS file that
plain "e" was replaced by bytes which read, in UTF-8:
capital-A-tilde, copyright sign. This is obviously nonsense -- and a
result of broken encoding in SPSS -- but it's nonetheless valid
UTF-8 so far as a computer is concerned.
Anyway, the real show-stopper for gretl reading back the gdt file
was that one of the value strings for one of the variables was
empty. I think -- I'm not 100% sure -- that must be due to an error
in the SPSS file, but in gretl git and snapshots I've made that sort
of error non-fatal: if a value string is empty we write in "empty
string" and continue loading the data.