[Digikam-devel] [Bug 139313] utf-8 image comments are mangled when input from image editor

Marcel Wiesweg marcel.wiesweg at gmx.de
Mon Jan 1 20:25:42 GMT 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=139313         
marcel.wiesweg gmx de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From marcel.wiesweg gmx de  2007-01-01 21:25 -------
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



More information about the Digikam-devel mailing list