Use JSON to support control characters#10
Use JSON to support control characters#10rathgar wants to merge 3 commits intojanfri:masterfrom rathgar:master
Conversation
|
Exiftool supports the -j option since version 7.65. So not to use JSON by default is a historic relict. I think it would be a better solution to check if exiftool is to old (< 7.65) and only in this the case use the "old" parse_line. A patch is very wellcome. :-) |
|
I've set it to use JSON by default now so long as exiftool is recent enough. apologies |
|
I'm not yet happy. The exiftool version is a very global thing. So I would prefer to use a class variable (@@use_json) for the flag and set it in the setup class method (analog to @@Separator or @@sep_op). |
|
So I've looked at your idea but the actual implementation dosn't pass all tests! Specially a defect encoding conversion is critical. I don't have much time at the moment and no idea how to fix it. :-( |
|
I have mini_exiftool 2.0.0 released. It uses JSON to parse the exiftool output (need exiftool version 7.65 or higher) and drop Ruby 1.8 compatibility. So I hope that helps. :-) |
|
That's fantastic! Thanks. I only wish I was able to contribute - I'll look out for other places I can help out. |
|
@rathgar Make all tests pass on windows. ;-) |
|
ROFL! If I had a windows machine, I might give it a go :-P |
When exiftool returns tag fields on the command line it converts control characters into
.You'll be familiar with this if you try to import images that have CR (char(13)) in the Caption-Abstract.
This commit optionally supports the miniexif
-joption viause_json: true. It will then use JSON to allow control characters in field values.I'm happy to be told this isn't the way to do it - I just needed a solution to process text fields correctly - I can't be the only one.