EXIF GetString and foreign characters

  • Thread starter Thread starter mikfrost
  • Start date Start date
M

mikfrost

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
manager.

// 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"?
 
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
manager.

// 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"?

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.
 
Back
Top