Skip to content

Use JSON to support control characters#10

Closed
rathgar wants to merge 3 commits intojanfri:masterfrom
rathgar:master
Closed

Use JSON to support control characters#10
rathgar wants to merge 3 commits intojanfri:masterfrom
rathgar:master

Conversation

@rathgar
Copy link
Copy Markdown

@rathgar rathgar commented May 16, 2013

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 -j option via use_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.

@janfri
Copy link
Copy Markdown
Owner

janfri commented May 16, 2013

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. :-)

@rathgar
Copy link
Copy Markdown
Author

rathgar commented May 16, 2013

I've set it to use JSON by default now so long as exiftool is recent enough.

apologies
Unfortunately, this has revealed that the tests fail as a result of not letting exiftool mangle the output. I am working to get it to pass the tests now. Hopefully, I can do this without too much input but I may need to ask you the odd question so that I don't do things that conflict with your general intention or other users' expected behaviour.

@janfri
Copy link
Copy Markdown
Owner

janfri commented May 17, 2013

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

@janfri
Copy link
Copy Markdown
Owner

janfri commented May 17, 2013

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. :-(

@janfri
Copy link
Copy Markdown
Owner

janfri commented May 23, 2013

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. :-)

@janfri janfri closed this May 23, 2013
@rathgar
Copy link
Copy Markdown
Author

rathgar commented May 23, 2013

That's fantastic! Thanks.

I only wish I was able to contribute - I'll look out for other places I can help out.

@janfri
Copy link
Copy Markdown
Owner

janfri commented May 24, 2013

@rathgar Make all tests pass on windows. ;-)

@rathgar
Copy link
Copy Markdown
Author

rathgar commented May 24, 2013

ROFL! If I had a windows machine, I might give it a go :-P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants