Open dirceu-jr opened 6 years ago
Can you give me some examples or sample images so that I can reproduce the same issue? Thanks!
Hi. I tried again today. I could get it to print exif data into Terminal. But when I try to render it in the Rails app, like:
file_io = IO.read(filename)
img_data = Exif::Data.new(file_io)
exif = img_data[:exif]
render json: exif
Rails throws:
Encoding::UndefinedConversionError ("\xA5" from ASCII-8BIT to UTF-8):
I'm using "exifr" until I figure out how to use "exif".
谢谢
@dirceup you should just force the string to convert to UTF-8.
str.encode(Encoding.find('UTF-8'), {invalid: :replace, undef: :replace, replace: ''})
https://stackoverflow.com/questions/12947910/force-strings-to-utf-8-from-any-encoding
While trying to use exif in a Rails app (utf-8 by default).