Search code examples
c++visual-c++unicodeexifwic

WIC - Exif Metadata Query - How to get image description


I have an image that has some French characters in the "Image Description" exif metadata field.

I m doing this (where reader is a IWICMetadataQueryReader* and value a PROPVARIANT):

reader->GetMetadataByName(L"/app1/ifd/{ushort=270}", &value);
if (value.vt == VT_LPSTR) result = value.pszVal;

and the result is "c'est l'été" instead of "c'est l'été"

How can I query so that it's a VT_LPWSTR instead, or any other way to get the correct string?


Solution

  • I found a solution using CA2W like so

    CA2W convertToUTF8(value.pszVal, CP_UTF8);
    result = convertToUTF8.m_psz;