devongovett / exif-reader

A small EXIF image metadata reader
MIT License
145 stars 22 forks source link

Support for non-ASCII charsets #17

Closed thomasgassmann closed 1 year ago

thomasgassmann commented 4 years ago

According to the spec, exif only supports ASCII.

2 = ASCII An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL.

Yet in practice, a lot of tools write UTF8 text into fields such as ImageDescription.

My suggestion would be to optionally support different charsets when decoding exif type 2.

If that's a change you're willing to accept, I'd gladly submit a PR.

lovell commented 4 years ago

Hi, perhaps if non-ASCII is detected, i.e. the top-bit of any char is set, then we should return a Buffer instead and let the caller decide how to decode.

If we do this, it would also make sense to expose the endianness (bigEndian) as you'd need that to handle UTF-16.

lovell commented 1 year ago

v1.2.0