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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Andras.Horvath
------- 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         
           Summary: utf-8 image comments are mangled when input from image
                    editor
           Product: digikam
           Version: 0.9.0
          Platform: Ubuntu Packages
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Image Editor
        AssignedTo: digikam-devel kde org
        ReportedBy: andras.horvath cern ch


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
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

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

Marcel Wiesweg
------- 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         




------- Additional Comments From marcel.wiesweg gmx de  2006-12-31 14:45 -------
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?
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

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

Andras.Horvath
In reply to this post by Andras.Horvath
------- 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         




------- Additional Comments From andras.horvath cern ch  2007-01-01 15:26 -------
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.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

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

Marcel Wiesweg
In reply to this post by Andras.Horvath
------- 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
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel