[gdal-dev] Codepage or UTF-8 in a metadata file Filename.aux in the Erdas Imagine format, describing a Filename.tif

Even Rouault even.rouault at spatialys.com
Mon Jun 26 05:05:30 PDT 2023


Mikael,

to my surprise, the HFA format is actually published at 
https://hexagongeospatial.fluidtopics.net/r/fH0o7KrMKUViXGUeoilQuA/5DlRUpslzb6NK6uTz98KSg 
. Not sure if it is "new" or had already been available. From a quick 
look, it doesn't mention anything about string encoding.

My intuition would be that the encoding would be whatever the one of the 
machine generated the file was, but perhaps that's a fixed one. You 
could potentially try to ask Hexagon support about that.

GDAL itself makes not that many assumptions about the encoding, although 
it tries to expose as UTF-8 as much as possible (and recode to UTF-8 
when it knows the source encoding), otherwise it will present strings as 
they are, hoping for the best. But language bindings might make stronger 
assumptions and indeed misbehave when UTF-8 is not encountered

Even

Le 26/06/2023 à 11:43, Mikael Rittri a écrit :
>
> Hello list.
>
> I have encountered a Filename.tif with an associated metadata file, 
> Filename.aux. The .aux file can be understood by gdalinfo, which says
>
> Driver: HFA/Erdas Imagine Images (.img)
>
> Files: Filename.aux
>
>        Filename.rrd
>
>        Filename.rde
>
> As I understand it, the .aux file is on an Erdas Imagine format 
> intended to describe metadata for the Erdas .img format, but it can 
> also be used to describe metadata for .tif files as in my case. (I 
> have the Filename.rrd and the Filename.rde but not any Filename.img, 
> so it is somewhat strange but useful that GDAL can read the .aux file 
> directly).
>
> Anyway, my question is: when the Filename.aux contains strings, in my 
> case descriptions of terrain types represented by integers (part of a 
> Raster Attribute Table), is there an established way to figure out 
> whether the strings are stored in UTF-8, or if not, what codepage is 
> used? In my case, the strings seem to be stored as 8-bit ASCII using 
> the codepage 1252 (mainly for West-European alphabets), but GDAL seems 
> to expect UTF-8 so the Swedish characters with diacritics become garbled.
>
> I realize that if the .aux format is proprietary and has just been 
> reverse-engineered, then maybe no-one knows the answer to this. But I 
> am curious if anyone has had similar problems and maybe figured out a 
> workaround. Or if there are any grounds to say that UTF-8 is mandatory 
> in the .aux format, then my example file would be incorrect and that 
> would also be useful to know.
>
> Best regards,
>
> Mikael Rittri
>
> Carmenta Geospatial Technologies
>
> Sweden
>
> carmenta.com
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230626/8de89a9f/attachment.htm>


More information about the gdal-dev mailing list