<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
        {font-family:"Segoe UI Semibold";
        panose-1:2 11 7 2 4 2 4 2 2 3;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI \,sans-serif";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        font-size:10.0pt;
        font-family:"Courier New",serif;
        mso-ligatures:none;
        mso-fareast-language:#2000;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle23
        {mso-style-type:personal-compose;
        font-family:"Segoe UI",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="en-SE" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI",sans-serif">Thank you, Even and Jukka.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI",sans-serif">Jukka: If the .rrd and .rde files just contain overviews, then they are irrelevant for my purpose. The .tif file itself doesn’t give me problems, but I want to extract its Raster
 Attribute Table, and it seems that I can read it from the .aux file via GDAL whether or not the .rrd and .rde files are present. That’s good to know. (I mean, it’s good for me to know which sidecar files I can ignore since there are a lot of them: some Erdas
 ones and some Esri ones and some that I don’t recognize at all.)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI",sans-serif">Even: Thanks for the link to the format description. Since I, too, fail to find anything about character encoding there, I suppose the format is neutral about that, and then GDAL
 just retrieves the byte sequences as they are. So I ought to make my software more robust when handling the retrieved strings, which is also good to know.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI",sans-serif">Regards,
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="en-SE" style="font-family:"Segoe UI",sans-serif"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Segoe UI Semibold",sans-serif;color:#D18765;mso-ligatures:none;mso-fareast-language:#2000">Mikael Rittri</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#D18765;mso-ligatures:none;mso-fareast-language:#2000"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:8.0pt;font-family:"Segoe UI Semibold",sans-serif;color:black;mso-ligatures:none;mso-fareast-language:#2000">Carmenta Geospatial Technologies<br>
Sweden</span><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial",sans-serif;color:black;mso-ligatures:none;mso-fareast-language:#2000"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:8.0pt;font-family:"Segoe UI",sans-serif;color:black;mso-ligatures:none;mso-fareast-language:#2000">carmenta.com<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="en-SE" style="font-family:"Segoe UI",sans-serif"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="mso-ligatures:none;mso-fareast-language:#2000">From:</span></b><span lang="EN-US" style="mso-ligatures:none;mso-fareast-language:#2000"> gdal-dev <gdal-dev-bounces@lists.osgeo.org>
<b>On Behalf Of </b>Even Rouault<br>
<b>Sent:</b> Monday, 26 June 2023 14:06<br>
<b>To:</b> gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> Re: [gdal-dev] Codepage or UTF-8 in a metadata file Filename.aux in the Erdas Imagine format, describing a Filename.tif<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <span style="mso-ligatures:none;mso-fareast-language:#2000"><o:p></o:p></span></p>
<table class="MsoNormalTable" border="0" cellspacing="3" cellpadding="0">
<tbody>
<tr>
<td style="background:white;padding:.75pt .75pt .75pt .75pt">
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width:100.0%">
<tbody>
<tr>
<td style="background:red;padding:5.25pt 1.5pt 5.25pt 1.5pt"></td>
<td width="100%" style="width:100.0%;background:#FFE6E6;padding:5.25pt 3.75pt 5.25pt 11.25pt">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wrap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizontal:column;mso-height-rule:exactly">
<b><span style="font-size:9.0pt;font-family:"Segoe UI",sans-serif;color:black">This message was sent from outside of Carmenta. Please do not click links or open attachments unless you recognize the source of this email and know the content is safe.
</span></b><o:p></o:p></p>
</div>
</td>
</tr>
</tbody>
</table>
<pre><span style="color:black"> </span><o:p></o:p></pre>
</td>
</tr>
</tbody>
</table>
<div>
<p>Mikael,<o:p></o:p></p>
<p>to my surprise, the HFA format is actually published at <a href="https://hexagongeospatial.fluidtopics.net/r/fH0o7KrMKUViXGUeoilQuA/5DlRUpslzb6NK6uTz98KSg">
https://hexagongeospatial.fluidtopics.net/r/fH0o7KrMKUViXGUeoilQuA/5DlRUpslzb6NK6uTz98KSg</a> . Not sure if it is "new" or had already been available. From a quick look, it doesn't mention anything about string encoding.<o:p></o:p></p>
<p>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.<o:p></o:p></p>
<p>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<o:p></o:p></p>
<p>Even<o:p></o:p></p>
<div>
<p class="MsoNormal">Le 26/06/2023 à 11:43, Mikael Rittri a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI ,sans-serif",serif">Hello list.
<br>
<br>
I have encountered a Filename.tif with an associated metadata file, Filename.aux. The .aux file can be understood by gdalinfo, which says<br>
<br>
</span><span lang="EN-GB" style="font-family:"Courier New",serif">Driver: HFA/Erdas Imagine Images (.img)</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Courier New",serif">Files: Filename.aux</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Courier New",serif">       Filename.rrd</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Courier New",serif">       Filename.rde
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="en-SE" style="font-family:"Segoe UI ,sans-serif",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI ,sans-serif",serif">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).
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI ,sans-serif",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI ,sans-serif",serif">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. </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI ,sans-serif",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Segoe UI ,sans-serif",serif">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.
<br>
<br>
Best regards, </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="en-SE" style="font-family:"Segoe UI ,sans-serif",serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt">Mikael Rittri</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:8.0pt">Carmenta Geospatial Technologies</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:8.0pt">Sweden</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:8.0pt">carmenta.com</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-ligatures:none;mso-fareast-language:#2000"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="en-SE"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-ligatures:none;mso-fareast-language:#2000"><br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>gdal-dev mailing list<o:p></o:p></pre>
<pre><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre>
<pre><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></pre>
</blockquote>
<pre>-- <o:p></o:p></pre>
<pre><a href="http://www.spatialys.com/">http://www.spatialys.com</a><o:p></o:p></pre>
<pre>My software is free, but my time generally not.<o:p></o:p></pre>
</div>
</div>
</body>
</html>