james-see / iptcinfo3

iptcinfo working for python 3 finally do pip3 install iptcinfo3
52 stars 31 forks source link

UTF-8 characters #7

Closed murraygm closed 5 years ago

murraygm commented 5 years ago

Hi, I'm struggling to get UTF-8 and emoji type special characters written to the IPTC data. I tried this: IPTCInfo(origPath, inp_charset='utf-8', out_charset='utf-8'). And clean: IPTCInfo(origPath)

But no joy, just keep getting this in the file info:

magistræde #🇩🇰

rather than this, which is the source (pulled from utf-8 JSON file):

magistræde #🇩🇰

james-see commented 5 years ago

@murraygm I was able to get it to work, seems ok using a test image I have here. I set the following:

    # info['city'] = '#magistræde #🇩🇰'
    info.save()

And then loading the data again using:

    info = iptcinfo3.IPTCInfo('testimage.jpg'])
    for k, v in info._data.items():
        print(k, v) 
...
65 b'FotoWare FotoStation'
80 b'Juliusz Karski'
105 b'Zapomniani \x9cwiadkowie XX wieku'
110 b'DSH/OK'
115 b'Archiwum Historii M\xf3wionej'
90 b'#magistr\xc3\xa6de #\xf0\x9f\x87\xa9\xf0\x9f\x87\xb0'
james-see commented 5 years ago

@murraygm if you can provide the code, the image, and the version of python you are using I can help futher, otherwise I am going to close the issue if it remains stale longer than the next two weeks. Also, please try the new version, pip3 install iptcinfo3 -U --no-cache. Should be version 2.1.4. Cheers!

james-see commented 5 years ago

Closing now, please file another issue if not working for you. Thanks!