Bug 421919 - Writing metadata not possible if path contains non-ANSI characters
Summary: Writing metadata not possible if path contains non-ANSI characters
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Engine (show other bugs)
Version: 7.0.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-22 14:43 UTC by ngocchibanh+kde
Modified: 2020-08-30 16:01 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.1.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ngocchibanh+kde 2020-05-22 14:43:41 UTC
SUMMARY
=======
Writing metadata is not possible if path contains non-ANSI characters
(not sure if this applies exactly on non-ANSI characters. I only tested it with random Chinese characters and characters with uncommon diacritics)

STEPS TO REPRODUCE
==================

Prerequisites 
-------------

0. Environment 
Windows 10 v1909
digikam 6.4.0 stable
digikam 7.0.0 beta 3

1. Enable writing metadata to file:
Settings > Configure Digikam > Metadata > Tab "Behaviour" > Box " Write this information to the metadata" > Tick box "Captions and title" (and/or any other; captions and title are the easiest to observe)

2. Have an image in a directory with only ANSI characters, e.g. C:\Users\USER\Pictures\

3. Have an image in a directory with at least one non-ANSI character, e.g C:\Users\USER\Pictures\đ
(here: lowercase d with a stroke above its "belly")

Steps to reproduce the bug
--------------------------

Select image file and add caption (e.g. via right sidebar "Captions" and confirm with "Apply (to all versions)". 


OBSERVED RESULT & EXPECTED RESULT
=================================


a) If this is done with the img file with only ANSI characters the captions are written to the image file. 
b) If this is done with the img file with non-ANSI characters the captions are silently not written to the image file. The captions are saved in the digikam database though. Captions that were not written to the image file can be retrieved only by viewing the image in digikam. 

(Editing meta via metadata editor (https://docs.kde.org/trunk5/en/extragear-graphics/digikam/tool-metadataeditor.html ) in case b does not work either. All fields appear grey. As a side note: the image preview in case b fails to load if the thumbnail is doubleclicked. Opening it via Item > Open is possible.)

The error log (created with https://docs.microsoft.com/en-us/sysinternals/downloads/debugview ) says for case a)

00000001	0.00000000	[5820] digikam.general: Writing tags	
00000002	0.00019080	[5820] digikam.metaengine: MetaEngine::metadataWritingMode 0	
00000003	0.00023000	[5820] digikam.metaengine: Will write Metadata to file "C:/Users/USER/Pictures/testimg.JPG"	
00000004	0.00183520	[5820] digikam.metaengine: wroteComment:  true	
00000005	0.00194850	[5820] digikam.metaengine: wroteEXIF:  true	
00000006	0.00215860	[5820] digikam.metaengine: wroteIPTC:  true	
00000007	0.00219940	[5820] digikam.metaengine: wroteXMP:  true	
00000008	0.03644430	[5820] digikam.metaengine: Metadata for file "testimg.JPG" written to file.	
00000009	0.04082260	[5820] digikam.dimg: "C:/Users/USER/Pictures/testimg.JPG" : "JPEG" file identified	
00000010	0.04756550	[5820] digikam.general: Detected change, triggering rescan of "C:/Users/USER/Pictures/"	
00000011	0.04758800	[19464] digikam.general: Detected change, triggering rescan of "C:/Users/USER/Pictures/"	
00000012	0.05689760	[5820] digikam.database: Scanning took 19 ms	
00000013	0.06187480	[5820] digikam.database: Finishing took 5 ms	
00000014	0.06832990	[5820] digikam.general: Trying to get thumbnail with Exiv2 for "C:/Users/USER/Pictures/testimg.JPG"	
00000015	0.06850200	[5820] digikam.general: Trying to get thumbnail with DImg preview for "C:/Users/USER/Pictures/testimg.JPG"	
00000016	0.07036120	[5820] digikam.general: Trying to get thumbnail with Exiv2 for "C:/Users/USER/Pictures/testimg.JPG"	
00000017	0.07050940	[5820] digikam.general: Trying to get thumbnail with DImg preview for "C:/Users/USER/Pictures/testimg.JPG"	
00000018	0.07063700	[5820] digikam.dimg: "C:/Users/USER/Pictures/testimg.JPG" : "JPEG" file identified	
00000019	0.07467710	[5820] digikam.dimg: "C:/Users/USER/Pictures/testimg.JPG" : "JPEG" file identified	


case b)
00000029	29.56537247	[5820] digikam.metaengine: Cannot load metadata from file C:/Users/USER/Pictures/?/testimg.JPG  (Error # 9 :  C:/Users/USER/Pictures/d/testimg.JPG: Failed to open the data source: No such file or directory (errno = 2)	
00000030	29.56577873	[5820] digikam.general: Writing tags	
00000031	29.56599045	[5820] digikam.metaengine: MetaEngine::metadataWritingMode 0	
00000032	29.56603432	[5820] digikam.metaengine: Will write Metadata to file "C:/Users/USER/Pictures/d/testimg.JPG"	
00000033	29.56628799	[5820] digikam.metaengine: Cannot save metadata to image using Exiv2   (Error # 9 :  C:/Users/USER/Pictures/d/testimg.JPG: Failed to open the data source: No such file or directory (errno = 2)	


SOFTWARE/OS VERSIONS
====================
Windows: 10 build 1909
KDE Plasma Version: ?
KDE Frameworks Version: KDE Frameworks 5.69.0
Qt Version: 5.14.2 (built against 5.14.2)

ADDITIONAL INFORMATION
======================
Printing the exif data with the 2017msvc64 build of Exiv2 v0.27.2 (https://www.exiv2.org/download.html ) via Powershell works. Changing directories is weird, though. 

Structure:
bin
|- exiv2.exe
|-đ (the only subdirectory in /bin)
  |- testimg.JPG


# "d" is from autocomplete
PS D:\stuff\bin> .\exiv2.exe .\d\testimg.JPG
.\d\testimg.JPG: Failed to open the file


# is done via autocomplete ".\" tab
PS D:\stuff\bin> cd .\d\
PS D:\stuff\bin\đ>
# works

# "cd .\đ\" is pasted in (U+0111 : LATIN SMALL LETTER D WITH STROKE), "cd .\d\" appears. Note that the stroke is missing. The "d" without the stroke is a U+0064 : LATIN SMALL LETTER D
PS D:\stuff\bin> cd .\d\
PS D:\stuff\bin\đ>
# works

# "cd .\d\" is pasted (lowercase latin letter D)
PS D:\stuff\bin> cd .\d\
cd : Cannot find path 'D:\stuff\bin\d\' because it does not exist.
At line:1 char:1
+ cd .\d\
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\stuff\bin\d\:String) [Set-Location], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
# Does not work.
Comment 1 Maik Qualmann 2020-05-22 14:55:10 UTC
The current digiKam-7.0.0-RC version supports the writing and reading of metadata as well as most other functions in Unicode paths under Windows.

https://files.kde.org/digikam/

Maik

*** This bug has been marked as a duplicate of bug 420195 ***
Comment 2 caulier.gilles 2020-08-30 16:01:06 UTC
Fixed with #420195