PHP version of ExifTool libraries

Started by wimvan, October 28, 2011, 11:55:57 AM

Previous topic - Next topic

Phil Harvey

#15
Hi Marcel,

Quote from: etmmger on January 14, 2012, 08:39:48 AM
However, I found out that php's json_decode() not always decodes the generated json correctly.

I ran some tests and find that this will happen if any of the strings are not valid UTF-8.  I knew that exiftool could produce invalid UTF-8, but didn't know that this would break a JSON parser.

I will change this in version 8.76 to replace invalid UTF-8 characters with "?" (incurring a small performance hit), which should solve the PHP json_decode() problem.

- Phil

Edit: Searching through the forum, I found this thread, where the JSON problem was exactly described to me.  I had forgotten about this.  Unfortunately, that thread didn't progress until a solution was found because we were looking specifically for a solution to the encoding of filenames, and a general patch like this to fix random UTF-8 errors wasn't suggested.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).