Follow

For the first time (in real code) I had to encode a string as UTF-16. The spec is a little unclear, but the UserComment tag in Unicode mode was only properly readable using UTF-16, and not UTF-8, at least with the CLI. Other programs don't recognize the tag at all. Worksforme™ now, but not really satisfactory, tbh. 😕

Snippet:

```
exif = image.getexif()
exif[0x9286] = b"UNICODE\x00" + data.encode("utf-16")
```

Sign in to participate in the conversation
FLOSS.social

For people who care about, support, or build Free, Libre, and Open Source Software (FLOSS).