<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi </span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"> I'm trying to extract CGM files from a NITF but the CGM are corrupt. </div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"> First I Unescape the CGM Data and I obtain something like</div><div style="font-family:arial,sans-serif;font-size:13px">
"\0,\vCreated CGM \"\0 f\0 ÿÿ\0 ...</div><div style="font-family:arial,sans-serif;font-size:13px"> Then write the text file. </div><div style="font-family:arial,sans-serif;font-size:13px"> </div><div style="font-family:arial,sans-serif;font-size:13px">
I compared this string with a CGM obtained from NITRO NITF (nitro_extract_cgm.exe).</div><div style="font-family:arial,sans-serif;font-size:13px"> The new CGM file start with </div><div style="font-family:arial,sans-serif;font-size:13px">
"\0,\vCreated CGM \"\0 f\0 ��\0<br></div><div style="font-family:arial,sans-serif;font-size:13px"> I succeed to read this CGM file with a CGM viewer. </div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">One of the difference come from caracter like ÿ (from GDAL) � from NITRO</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Then It's probably something I missed in the Escaping/Unescaping function </div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Because UnescapeScring wasn't exposed in C# I wrote a function : </div>
<div style="font-family:arial,sans-serif;font-size:13px"><div>static public string UnescapeString(string pszInput)</div><div> {</div><div> string pszOutput=""; </div><div> int iIn = 0;</div>
<div> for (iIn = 0; iIn<pszInput.Length; iIn++)</div><div> {</div><div> if (pszInput[iIn] == '\\')</div><div> {</div><div> iIn++;</div><div>
if (pszInput[iIn] == 'n')</div><div> pszOutput += '\n';</div><div> else if (pszInput[iIn] == '0')</div><div> pszOutput += '\0';</div>
<div> else</div><div> pszOutput += pszInput[iIn];</div><div> }</div><div> else</div><div> {</div><div> pszOutput += pszInput[iIn];</div>
<div> }</div><div> }</div><div> return pszOutput;</div><div> }</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
thanks in advance!</div><div style="font-family:arial,sans-serif;font-size:13px">Best regards </div></div>