Summary: | utf-8 image comments are mangled when input from image editor | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Andras HORVATH <andras.horvath> |
Component: | Tags-Captions | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | caulier.gilles |
Priority: | NOR | ||
Version: | 0.9.0 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.1 | |
Sentry Crash Report: |
Description
Andras HORVATH
2006-12-28 12:48:24 UTC
I cannot reproduce this. Do you change the comment from the "Comments/Tags" sidebar in the Image Editor? Where is the wrong encoding visible: Comments/Tags sidebar in main view? Metadata Sidebar, Exif, "UserComment"? Metadata Sidebar, IPTC, "Caption"? Properties Sidebar? What does a test string like "éèöäüßç" look like? Okay, I've found a way to reproduce this reliably (although I was wrong about the double encoding, it's plain old UTF-8 displayed as ASCII/Latin-1): 1. open up pic with existing comment (set by Digikam or anything else) in Image Editor 2. select a region, click on Crop, click on Save 3. close the IE window 4. run 'exiv2 -p c' (or jhead) on the picture file and observe the mangled comment After point 3, the Metadata sidebar shows that the Exif UserComment field is empty and that the comment field is removed from the IPTC header. In addition, I've observed the following: 1. open up pic with existing comment (set by Digikam or anything else) in Image Editor 2. delete the comment using the Comments/Tags sidebar (by clearing the Comments field). 3. Close Image Editor 4. run 'exiv2 -p c' (or jhead) on the picture file and observe that it still has the old comment. The Metadata sidebar agrees. I hope this helps. Thanks for the quick reply and please let me know if you need any more data. SVN commit 618621 by mwiesweg: DMetadata getComments and setComments must be symmetric. Loading a QString from a QByteArray means interpreting the data as classic C String, but the data may be UTF8. BUG: 139313 M +3 -7 dmetadata.cpp --- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp #618620:618621 @@ -120,9 +120,7 @@ QByteArray DMetadata::getComments() const { - QByteArray data(d->imageComments.size()); - memcpy(data.data(), d->imageComments.c_str(), d->imageComments.size()); - return data; + return QByteArray().duplicate(d->imageComments.data(), d->imageComments.size()); } QByteArray DMetadata::getExif() const @@ -196,11 +194,9 @@ void DMetadata::setComments(const QByteArray& data) { - QString string(data); - const std::string str(string.utf8()); - d->imageComments = str; + d->imageComments = std::string(data.data(), data.size()); } - + bool DMetadata::setExif(const QByteArray& data) { try |