Bug 144713 - utf8 not supported in "rename images" tool
Summary: utf8 not supported in "rename images" tool
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: AdvancedRename-dialog (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-26 16:01 UTC by Romain Diss
Modified: 2022-02-01 06:40 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.5.0


Attachments
Do not assume locale charset is Latin1 (1001 bytes, patch)
2009-01-15 10:36 UTC, Aurelien Gateau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Diss 2007-04-26 16:01:45 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc ? target: i486-linux-gnu
OS:                Linux

Accentuated characters (and probably more generally UTF8 characters) are not well supported in the "rename images" plugin.
The accentuated characters are well handled in the "prefix" field but not in the "date format" field.
When "é_%Y-%m-%d" is entered in the "date format" field, then the file is given the name "Ä©_2007-04-26". So it certainly is an utf8 problem.
Comment 1 caulier.gilles 2008-12-07 21:31:10 UTC
Can,

This file still valid using kipi-plugins 0.1.6 ?

Gilles Caulier
Comment 2 Romain Diss 2009-01-03 14:31:16 UTC
(In reply to comment #1)
> This file still valid using kipi-plugins 0.1.6 ?
This bug still exist with kipi-plugins 0.1.6.
Comment 3 Aurelien Gateau 2009-01-15 10:36:29 UTC
Created attachment 30267 [details]
Do not assume locale charset is Latin1
Comment 4 Aurelien Gateau 2009-01-15 10:36:53 UTC
Can you try attached patch?
Comment 5 Romain Diss 2009-01-15 21:43:54 UTC
I've never done that before and I'm not sure to know the exact way to try this patch. Do you have some links which could briefly help me to know what are the sources I need to compile and how to apply this patch. (I'm using Debian Sid).
Comment 6 Aurelien Gateau 2009-01-15 23:16:26 UTC
On a Debian, the simplest way is to do it this way (from memory):

# Install the needed packages
- sudo apt-get install debuild
- sudo apt-get build-dep kipi-plugins

# Download the source package
- mkdir foo
- cd foo
- apt-get source kipi-plugins
(Creating a folder is a good idea because apt-get source will bring a few files)

# Apply the patch
- cd kipi-plugins-0.1.6
- patch -p1 < path/to/the/patch

# Build the package
- debuild

# Install the package
- cd ..
- sudo dpkg -i kipi-plugins_0.1.6-1_i386.deb

Comment 7 Romain Diss 2009-01-17 10:15:51 UTC
Thank you for the explanations.

By trying to apply the patch, I realized a strange thing. When I had downloaded the kipi-plugins sources with aptitude, I got the kipi-kipi-plugins-0.1.5 version. I checked with "aptitude show kipi-plugins" that I have the 0.1.5 version installed. But when I go in the Digikam's "about" menu, it tells me that I'm using the 0.1.6.

So for the moment, I did not managed to apply the patch. The error message I got is :
"patching file kipi-plugins/batchprocessimages/renameimageswidget.cpp
Hunk #1 FAILED at 446.
1 out of 1 hunk FAILED -- saving rejects to file kipi-plugins/batchprocessimages/renameimageswidget.cpp.rej"

I suppose this is due to the version mismatch...

What can I do now ?
Comment 8 Aurelien Gateau 2009-01-18 21:09:19 UTC
The patch is quite simple, you should be able to apply it manually to version 0.1.5:
- Look for lines like this:

    ::strftime(s, 100, QFile::encodeName(format), time_tm);
 
    newName += QString::fromLatin1(s);

And replace fromLatin1 with fromLocal8Bit.

What I find difficult to understand however is the fact that Digikam says it's using version 0.1.6. Did you install Digikam and/or kipi-plugins by hand?
Comment 9 Aurelien Gateau 2009-01-19 15:59:51 UTC
SVN commit 913586 by gateau:

Do not assume locale charset is Latin1.
BUG: 144713


 M  +1 -1      renameimageswidget.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=913586
Comment 10 Romain Diss 2009-01-19 22:02:19 UTC
> And replace fromLatin1 with fromLocal8Bit.
I replaced fromLatin1 with fromLocal8Bit everywhere in all the files in kipi-plugins sources, not only those which look like this :
    ::strftime(s, 100, QFile::encodeName(format), time_tm);

    newName += QString::fromLatin1(s);

I don't now if this should have side effects, but it works fine now !

Thank you for your help.
Do you think this bug should be marked closed ?
Comment 11 Aurelien Gateau 2009-01-19 23:33:50 UTC
After a quick grep on the sources, it appears the other places where fromLatin1() is called it is called with constant ascii strings, so changing those calls to fromLocal8Bit() won't fix anything.

Anyway, the bug is closed now, thanks for the report!