EXIF GetString and foreign characters

Discussion in 'ASP .Net' started by mikfrost, Apr 6, 2007.

  1. mikfrost

    mikfrost Guest

    I'm trying to read the exif info in a JPG image file. Reading the
    ImageDescription field (270) that contains "abcæåø" only reads the
    first 3 characters "abc". The field was written with ACDSee photo

    // using the GetString method

    propItem = img.GetPropertyItem(270);
    img_desc = Encoding.UTF8.GetString(propItem.Value);

    // result : img_desc = "abc"

    // BitConverter reads the correct acsii values!!

    acsii_values = BitConverter.ToString(propItem.Value);

    // result : acsii_values = "61-62-63-E6-E5-F8-00"

    Why does GetString not get the foreign charaters "E6-E5-F8"?
    mikfrost, Apr 6, 2007
    1. Advertisements

  2. mikfrost

    mikfrost Guest

    The field was written in iso8859-1. This fixed the problem:

    Encoding iso = Encoding.GetEncoding("iso8859-1");
    img_desc = iso.GetString(propItem.Value);

    I guess there is no method to detect which encoding is used in the
    EXIF field.
    mikfrost, Apr 7, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.