Quantcast
Channel: Adobe Community: Message List - XMP SDK
Viewing all articles
Browse latest Browse all 801

Re: Problem with reading PNG metadata due to unicode strings

$
0
0

OK, I now understand the point you were driving at.

To check out this idea, I have modified the code in the routine which dumps the output from the callback to a file as follows:

(Though if you were to dump the file using the std:: stream - .i.e. using the utility as supplied, you should see the same problem - it is not at all dependent on my using the wxWidgets toolkit)

XMP_Status DumpXMPToFile(void * WXUNUSED(refCon), XMP_StringPtr buffer, XMP_StringLen bufferSize )

{

    XMP_Status status = 0;

    wxString wsT;

    try

    {

    wxString wsText( buffer, wxConvUTF8 );

    if( g_wfDumpFile.IsOpened() )

    {

      wsT.Printf( _T("<%s> size(%d)"), wsText, bufferSize );

      g_wfDumpFile.SeekEnd();

      g_wfDumpFile.Write( wsT, wsT.Length() );

    }

    else

      return -1;

    }

    catch(XMP_Error & e)

    {  .......

 

The output for the one line in question:

<Iptc4xmpCore:CiAdrExtadr> size(24)< = "> size(4)<Leo-Saurer-Straße> size(15)<> size(1)<C3> size(2)<> size(1)<9F> size(2)<>> size(1)<e> size(1)<"> size(1)<

> size(1)<   > size(3)<   > size(3)<   > size(3)

 

The hex contents of the buffer I get in the callback is

0x003908D0  4c 65 6f 2d 53 61 75 72 65 72 2d 53 74 72 61 c3 9f 65 00 cd cd cd cd  Leo-Saurer-Straße.ÍÍÍÍ

0x003908E7  cd cd cd cd cd cd cd cd cd fd fd fd fd ab ab ab ab ab ab ab ab ee fe  ÍÍÍÍÍÍÍÍÍýýýý««««««««îþ

 

As you can see, my conversion routines takes all the buffer contains and converts it to the appropriate UTF-8 string, even though the count passed to me is short and represents only the count up to the first non-ASCII character and all of the subsequent strings  - interpreted as hex values by the caller of the call back would not give me the correct characters, athough they are passed to me for display.

 

The two fragments of one byte length are the ones I could not find in the actual output.

 

The call stack at that point:

>wxMeta.exe!DumpXMPToFile(void * __formal, const char * buffer, unsigned long bufferSize)  Line 110C++
wxMeta.exe!TextOutputProcWrapper(void * refCon, const char * buffer, unsigned long bufferSize)  Line 60 + 0x18 bytesC++
wxMeta.exe!DumpClearString(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & value, long (void *, const char *, unsigned long)* outProc, void * refCon)  Line 409 + 0x1c bytesC++
wxMeta.exe!DumpPropertyTree(const XMP_Node * currNode, int indent, unsigned int itemIndex, long (void *, const char *, unsigned long)* outProc, void * refCon)  Line 161 + 0x14 bytesC++
wxMeta.exe!DumpPropertyTree(const XMP_Node * currNode, int indent, unsigned int itemIndex, long (void *, const char *, unsigned long)* outProc, void * refCon)  Line 222 + 0x1f bytesC++
wxMeta.exe!XMPMeta::DumpObject(long (void *, const char *, unsigned long)* outProc, void * refCon)  Line 1100 + 0x23 bytesC++
wxMeta.exe!WXMPMeta_DumpObject_1(__XMPMeta__ * xmpObjRef, long (void *, const char *, unsigned long)* outProc, void * refCon, WXMP_Result * wResult)  Line 968C++
wxMeta.exe!TXMPMeta<std::basic_string<char,std::char_traits<char>,std: :allocator<char> > >::DumpObject(long (void *, const char *, unsigned long)* outProc, void * refCon)  Line 833 + 0x21 bytesC++
wxMeta.exe!MyFrame::DisplayMetaData(wxString & wsrFilePathAndName)  Line 484C++

 

Hoping this will help resolve the issue :-)


Viewing all articles
Browse latest Browse all 801

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>