janfri / mini_exiftool

This library is a wrapper for the Exiftool command-line application (https://exiftool.org) written by Phil Harvey. It provides the full power of Exiftool to Ruby: reading and writing of EXIF-data, IPTC-data and XMP-data. Branch master is for actual development and branch compatibility-version is for compatibility with Ruby 1.8 and exiftool versions prior 7.65.
GNU Lesser General Public License v2.1
213 stars 52 forks source link

ArgumentError: invalid byte sequence in UTF-8 #2

Closed schneikai closed 12 years ago

schneikai commented 12 years ago

hi,

i'm getting 'ArgumentError: invalid byte sequence in UTF-8' in gems/mini_exiftool-1.4.3/lib/mini_exiftool.rb:322 on this image https://dl.dropbox.com/u/3488707/metadata5small.jpg

the image has some german special chars like ä ö ß but other images with such characters work.

any ideas? would like to help.

kai

rathgar commented 12 years ago

Glad it's not just me then. We're getting this on quite a few - v large batches so can't give a specific example at this point. I'm on a similar version to yours but upgrading to latest stable (1.5.1) so will let you know if that helps.

janfri commented 12 years ago

Which Ruby version are you using? Which operating system which console locale?

schneikai commented 12 years ago

it's ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]. console locale is :en

janfri commented 12 years ago

It seems you use different encodings in different tags. You can see this when using exiftool direct:

exiftool -imagedescription -caption-abstract  metadata5small.jpg

However, you can fix it in MiniExiftool with the convert_encoding option

photo = MiniExiftool.new('metadata5small.jpg', :convert_encoding => true)

This is uses the -L option in exiftool and you get all values in Latin1 encoding.

Übrigens: Ich wohne in Niedersachsen. ;-)

schneikai commented 12 years ago

is working nicely! thank you for your help!

viele grüße aus berlin! :)

rathgar commented 12 years ago

Have run that across many thousands and not one error since :) thanks