gomfunkel / node-exif

A node.js library to extract Exif metadata from images.
MIT License
581 stars 104 forks source link

Garbled unicode sequences when retrieving exif metadata #56

Open ticklemynausea opened 8 years ago

ticklemynausea commented 8 years ago

Hi. I've come across this issue when processing photos with tags that have multibyte characters. Such names appear garbled when retrieved using node-exif.

To reproduce, add a tag like this to an image if you don't have one already

❯ exiftool -artist='Bélà Lugôsí' image.jpg
    1 image files updated

Retrieving the info with identify gives us the name correctly

❯ identify -verbose image.jpg | grep Artist
    exif:Artist: Bélà Lugôsí

Now, using node-exif in a REPL environment:

> new require('exif').ExifImage({ image: 'image.jpg' }, (error, info) => console.log(info.image.Artist)),null;
null
> Bélà Lugôsí

The characters with diacritic marks are two-byte characters, but node-exif doesn't recognize them as such.