Bug 501067 - Changing Creation Date with metadata Editor / Exif changes content of description field to Chinese characters.
Summary: Changing Creation Date with metadata Editor / Exif changes content of descrip...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Exif (show other bugs)
Version: 8.5.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-04 19:31 UTC by Wolf
Modified: 2025-03-05 21:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 8.6.0
Sentry Crash Report:


Attachments
Starting point (65.24 KB, image/png)
2025-03-04 19:31 UTC, Wolf
Details
first change of time tag (71.29 KB, image/png)
2025-03-04 19:31 UTC, Wolf
Details
second change of time tag (74.56 KB, image/png)
2025-03-04 19:32 UTC, Wolf
Details
special character "ß" stays Chinese (64.74 KB, image/png)
2025-03-04 19:32 UTC, Wolf
Details
Sample picture for character issue (182.03 KB, image/jpeg)
2025-03-04 21:45 UTC, Wolf
Details
Metadata Settings 1 (51.86 KB, image/png)
2025-03-04 21:50 UTC, Wolf
Details
metadata settings 2 (49.45 KB, image/png)
2025-03-04 21:51 UTC, Wolf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wolf 2025-03-04 19:31:15 UTC
Created attachment 179116 [details]
Starting point

SUMMARY

If the description tag of a photo contains special characters that are for instance common in German  (e. g. ö, ü, ä, ß) editing an EXIF-time tag (e. g. DateTimeOriginal) via the Metadata Editor changes the content of the description field to seemingly random Chinese characters (according to deepl some of the characters end up meaning "shot", "vase", "injection" , "sun", "climbing" among other meanings but apparently don't add up to something meaningful).

A following second edit of a time tag changes the content of the description field back to its original state (given it is no "ß", where the character just stays Cinese). 

With every additional edit of the time tags the description tag alternates between original content and Chinese characters.

STEPS TO REPRODUCE
1. Select a photo that has content in the description tag (XMP, IPTC)
2. Open Metadata-Editor
3. Edit any tag in Exif > Date and Time (e.g. Creation Date) with "synchronization for XMP/iptc on"
4. Apply changes
5. Edit time tag a second time
6. apply changes
7. edit time tag a third time
8. apply changes

OBSERVED RESULT
1-4:
- time/date tag correctly changed in EXIF, IPTC, XMP
- content of description tags (EXIF, IPTC, XMP) changes to Chinese characters
5-6:
- time/date tag correctly changed in EXIF, IPTC, XMP
- content of description tags (EXIF, IPTC, XMP) changes back to original
7-8:
- time/date tag correctly changed in EXIF, IPTC, XMP
- content of description tags (EXIF, IPTC, XMP) changes back to Chinese characters

EXPECTED RESULT
only time tags change, no alternating between random Chinese characters and original content of description tags


SOFTWARE/OS VERSIONS
Windows: Windows 10 Version 22H2 (x86_64)
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: Version 6.7.0
Qt Version: Version 6.7.2 (kompiliert gegen 6.7.2)

ADDITIONAL INFORMATION
see screenshots
Comment 1 Wolf 2025-03-04 19:31:50 UTC
Created attachment 179117 [details]
first change of time tag
Comment 2 Wolf 2025-03-04 19:32:11 UTC
Created attachment 179118 [details]
second change of time tag
Comment 3 Wolf 2025-03-04 19:32:45 UTC
Created attachment 179119 [details]
special character "ß" stays Chinese
Comment 4 Maik Qualmann 2025-03-04 19:46:14 UTC
I can't reproduce the problem at the moment, we need more information.

1. Screenshot of the metadata settings
2. Screenshot of the advanced metadata settings for caption.
3. Preferably a sample image with which the problem can be reproduced

I suspect that the caption was set with a program other than digiKam? Because I suspect UTF-16 encoding.

Maik
Comment 5 Wolf 2025-03-04 21:45:17 UTC
Created attachment 179125 [details]
Sample picture for character issue

That is one of the pictures, where the described bug occurs. Captions/description generated with digiKam.
Comment 6 Wolf 2025-03-04 21:50:47 UTC
Created attachment 179126 [details]
Metadata Settings 1
Comment 7 Wolf 2025-03-04 21:51:17 UTC
Created attachment 179127 [details]
metadata settings 2
Comment 8 Wolf 2025-03-04 22:02:07 UTC
(In reply to Maik Qualmann from comment #4)
> I can't reproduce the problem at the moment, we need more information.
> 
> 1. Screenshot of the metadata settings
> 2. Screenshot of the advanced metadata settings for caption.
> 3. Preferably a sample image with which the problem can be reproduced
> 
> I suspect that the caption was set with a program other than digiKam?
> Because I suspect UTF-16 encoding.
> 
> Maik


Hi Maik,

sorry if I am not doing the reporting correctly. Bug reporting still is kinda new for me. To your questions:

1. and 2. please see the uploaded screenshots
3. I uploaded one of the sample pictures

I exclusively use digiKam for organizing my photos/screenshots. So all captions/descriptions etc. are done via digiKam. 

I just checked, if maybe digiKam only shows those Chinese characters while in the file there is actually the "regular" caption. But IrfanView, for instance, shows Chinese characters, too. 

Wolf
Comment 9 Maik Qualmann 2025-03-05 07:41:43 UTC
Thank you for the information provided.
I cannot reproduce the switch to Chinese characters in the digiKam view at the moment, but the problem is clear. The Chinese characters are created in the EXIF ​​user comment and are forwarded to XMP by the metadata editor.
The cause is that your EXIF ​​metadata in the image is encoded in big-endian (Motorola).
As a workaround, you can enable writing with ExifTool, ExifTool generally writes Exif metadata in little-endian (Intel) encoding.
I will fix the problem this evening.

Maik
Comment 10 Wolf 2025-03-05 20:01:26 UTC
Thank you very much for your help and the upcoming fix!
For now I'll do as you suggested and will enable Exif-Tool for metadata writing.

(It might be not relevant anymore, but I did some further testing and can replicate the error with the current digiKam AppImage for Linux (digiKam-8.5.0-Qt6-x86-64.appimage) on a current Linux Mint 22.1 / XFCE installation, too.
And I can confirm - after checking on other pictures - that (at least in my case) only Big-endian byte order pictures are affected of the described character switch. Upon looking through several pictures I realized that apparently some cameras and cell phones use Big-endian for their image files while others use Little-endian.)

Thanks again for your help.

Wolf
Comment 11 Maik Qualmann 2025-03-05 21:11:43 UTC
Git commit 7e76a3d2287e6759f2c6aefe4401ced89766aaf4 by Maik Qualmann.
Committed on 05/03/2025 at 21:10.
Pushed by mqualmann into branch 'master'.

fix Exif byte order problem with user comment
FIXED-IN: 8.6.0

M  +1    -1    core/libs/metadataengine/engine/metaengine_p.cpp

https://invent.kde.org/graphics/digikam/-/commit/7e76a3d2287e6759f2c6aefe4401ced89766aaf4