← Back to team overview

pyexiv2-developers team mailing list archive

Re: Null bytes in strings

 

On 06/04/2010 10:13 AM, Olivier Tilloy wrote:
Hi Damon&  all,

On 2010-06-04, Damon Lynch<damonlynch@xxxxxxxxx>  wrote:
Hi everyone,

What is the best way for Pyexiv2 to handle Exif values that have Null
bytes ('\x00') in the string value? They are problematic -- any strings
containing them cannot be used as filenames, for instance.

Should the raw_value, value or human_value have Null bytes automatically
stripped, or should that decision be made by the calling application?
Or should the utilities module have a "sanity checker" to examine the
Exif values?
At the moment, decision of what to do is left to the calling
application, pyexiv2 doesn't apply any processing to string containing
Null bytes. I'm open to re-considering this behaviour though, provided
we have clear use-cases which would benefit from it.

Do you have examples of images with Exif values containing null bytes,
and do you know the reason for such values?

The problem occurs in files that have been edited and had their EXIF data messed up by poorly written programs. In the file a user of Rapid Photo Downloader sent me, the values for camera manufacturer and camera model had two null bytes at the end of each string, and two extraneous regular characters. There is obviously nothing we can do about the extraneous regular characters, but the null bytes are a different case.

Other similar problems can pop up. One I have seen is where the editing program has changed the format in the date fields.

This make me wonder if a "sanity check" utility function might be a useful addition to pyexiv2.

I will send Olivier offlist a couple of example files.

Damon

--

http://www.damonlynch.net




Follow ups

References