Version: 0.9.0 (using KDE KDE 3.5.2) Installed from: Ubuntu Packages Compiler: gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5) OS: Linux When adding image comments from the main digikam "view", everything is fine. However, when adding utf-8 characters from the Image Editor, they somehow become doubly/wrongly encoded (e.g. the result is three bytes per accented char) before written into the image. otherwise, I love 0.9.0 :-) cheers
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