Skip to content

Automate transcoding of userComment string value #117

@nhoizey

Description

@nhoizey

When I activate userComment extraction with userComment: true, I get an object like this (shortened):

{
  "userComment": {
    "0": 65,
    "1": 83,
    "2": 67,
    "3": 73,
    "4": 73,
    "5": 0,
    "6": 0,
    "7": 0,
    "8": 80,
    "9": 104,
    "10": 111,
    "11": 116,
    "12": 111,
    "13": 32,
    "14": 111,
    "15": 102,
    "16": 32,
    "17": 116,
    "18": 104,
    "19": 114,
    "20": 101,
    "20": 101
  }
}

This is a sequence of character codes, which we can translate to a string, for example with this code:

Object.values(output.userComment)
  .map((char) => String.fromCharCode(char))
  .join('');

Here, we get the string ASCII\0\0\0Photo of three.

It would be nice if:

  • we did get the string strait from exifr
  • the encoding part in the beginning would be removed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions