Thanks it works well ! I succeed to export graphics from the NITF file. But I didn't understand why my C# function was wrong.
Best regards. 2013/6/20 Livneh Yehiyam <[email protected]> > Hi**** > > You can use the GDAL unescape function like this:**** > > ** ** > > /// <summary>**** > > /// Remove "backslash quotable" escape characters from the string > and convert it to byte array.**** > > /// </summary>**** > > public static byte[] RemoveEscapeCharacters(this string value)**** > > {**** > > if(String.IsNullOrEmpty(value))**** > > {**** > > return new byte[0];**** > > }**** > > int length = value.Length;**** > > IntPtr escapedString = CPLUnescapeString(value, ref length, > 0);**** > > byte[] escapedBytes = new byte[length];**** > > Marshal.Copy(escapedString, escapedBytes, 0, length);**** > > VSIFree(escapedString);**** > > return escapedBytes;**** > > }**** > > ** ** > > [DllImport("gdal18.dll", EntryPoint = "CPLUnescapeString", > CallingConvention = CallingConvention.Cdecl)]**** > > private static extern IntPtr CPLUnescapeString(string input, ref > int length, int scheme);**** > > ** ** > > [DllImport("gdal18.dll", EntryPoint = "VSIFree", > CallingConvention = CallingConvention.Cdecl)]**** > > private static extern void VSIFree(IntPtr input);**** > > ** ** > > ** ** > > Yehiyam**** > > ** ** > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *xavier lhomme > *Sent:* Wednesday, June 19, 2013 11:50 PM > *To:* gdal-dev > *Subject:* [gdal-dev] Extract CGM from a NITF file**** > > ** ** > > Hi **** > > ** ** > > I'm trying to extract CGM files from a NITF but the CGM are corrupt. *** > * > > ** ** > > First I Unescape the CGM Data and I obtain something like**** > > "\0,\vCreated CGM \"\0 f\0 ÿÿ\0 ...**** > > Then write the text file. **** > > **** > > I compared this string with a CGM obtained from NITRO NITF > (nitro_extract_cgm.exe).**** > > The new CGM file start with **** > > "\0,\vCreated CGM \"\0 f\0 ��\0**** > > I succeed to read this CGM file with a CGM viewer. **** > > ** ** > > One of the difference come from caracter like ÿ (from GDAL) � from NITRO** > ** > > ** ** > > Then It's probably something I missed in the Escaping/Unescaping function > **** > > ** ** > > Because UnescapeScring wasn't exposed in C# I wrote a function : **** > > static public string UnescapeString(string pszInput)**** > > {**** > > string pszOutput=""; **** > > int iIn = 0;**** > > for (iIn = 0; iIn<pszInput.Length; iIn++)**** > > {**** > > if (pszInput[iIn] == '\\')**** > > {**** > > iIn++;**** > > if (pszInput[iIn] == 'n')**** > > pszOutput += '\n';**** > > else if (pszInput[iIn] == '0')**** > > pszOutput += '\0';**** > > else**** > > pszOutput += pszInput[iIn];**** > > }**** > > else**** > > {**** > > pszOutput += pszInput[iIn];**** > > }**** > > }**** > > return pszOutput;**** > > }**** > > ** ** > > thanks in advance!**** > > Best regards **** > ________________________________________ > This message (including any attachments) issued by RAFAEL- ADVANCED > DEFENSE SYSTEMS LTD. (hereinafter "RAFAEL") contains confidential > information intended for a specific individual and purpose, may constitute > information that is privileged or confidential or otherwise protected from > disclosure. If you are not the intended recipient, you should contact us > immediately and thereafter delete this message from your system. You are > hereby notified that any disclosure, copying, dissemination, distribution > or forwarding of this message, or the taking of any action based on it, is > strictly prohibited. If you have received this e-mail in error, please > notify us immediately by e-mail mailto:[email protected] and completely > delete or destroy any and all electronic or other copies of the original > message and any attachments thereof. >
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
