ExifTool Forum

ExifTool => Newbies => Topic started by: fast Eddy on December 21, 2024, 07:14:46 AM

Title: question mark is written instead of an UTF-8 character
Post by: fast Eddy on December 21, 2024, 07:14:46 AM
I use the python wrapper around the exiftool, like:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from exiftool import ExifToolHelper

images = ["skyblue.png"]
et =  ExifToolHelper()
tag = 'XMP:Creator'
people = "Edwin, Juliëte, Sánder"

with ExifToolHelper() as et:
    et.set_tags(
        images,
        tags={"XMP:Creator": people},
        params=["-P", "-overwrite_original"]
    )

d = et.get_metadata(images)
print('{0}:{1}'.format(tag, d
[o][tag]))

Output:
XMP:Creator:Edwin, Juli?te, S?nder

the output should be:
Output:
XMP:Creator:Edwin, Juliëte, Sánder

What do I have to change in my script to create this?


Title: Re: question mark is written instead of an UTF-8 character
Post by: Phil Harvey on December 21, 2024, 07:58:53 AM
It looks like the Charset setting wasn't correct when the information was written.  See FAQ 10 (https://exiftool.org/faq.html#Q10) for details.

- Phil
Title: Re: question mark is written instead of an UTF-8 character
Post by: StarGeek on December 21, 2024, 10:08:01 AM
They are using PyExiftool, which is using -Stay_Open. Shouldn't writing data be unaffected by character coding when doing this?

@Eddy, if you are on Windows, then FAQ #18, problems with special characters on the Windows command line (https://exiftool.org/faq.html#Q18) might be applicable.
Title: Re: question mark is written instead of an UTF-8 character
Post by: Phil Harvey on December 21, 2024, 10:29:22 AM
There are various places this could go wrong:

1. If the characters in the script aren't UTF-8

2. If the python wrapper is specifying another -charset for ExifTool

3. If whatever shell you are using to display the final result isn't using UTF-8

- Phil