Bug 395652

Summary: [Windows] Cannot remove brush presets with CJK letters in their filenames
Product: [Applications] krita Reporter: Tyson Tan <tysontanx>
Component: Resource ManagementAssignee: Halla Rempt <halla>
Status: RESOLVED FIXED    
Severity: normal CC: jtamate, ThetaForBugRep
Priority: NOR    
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Tyson Tan 2018-06-20 14:03:10 UTC
On Windows systems, Krita cannot remove brush presets with CJK letter in their names. Reported by Chinese Krita community. Confirmed on 4.0.4 and Nightly, under freshly installed Windows 7 SP1 and Windows 10 1803, with all Windows Update patches installed.

How to reproduce:
1) Edit Brush Settings >> Save New Brush Preset
2) Input some CJK letters for the new brush preset's name, for example: "测试 (Test for Chinese)", "テスト (Test for Japanese)".
3) Remove the newly created brush preset.
4) Restart Krita.
5) The supposedly removed brush preset returns.

Addtional information:
1) Windows only. Not happening on Linux.
2) Not affecting English named brush presets.
3) I suspect Qt is expecting filename character encoding as UTF-8, but on Windows system, file system is STILL not encoded with Unicode but ANSI. English as ISO-8859-15, Simplified Chinese as GB2312/GB18030/GBK, Japanese as Shift-JIS. It could be that Krita sees mis-interpreted file names through Qt under Windows and failed to delete the preset.
4) I suggest further investigation into this problem, especially where Qt is handing file names.
Comment 1 Jaime Torres 2018-09-24 11:01:14 UTC
Confirmed on windows nightly build.
The brushes are always kept on the filesystem, but they are avoided using a blacklist stored in: .local/share/krita/kis_paintoppresets.blacklist in linux and $User\AppData\Roaming\krita\kis_paintoppresets.blacklist in windows.

While the name of the file is 
<name>~/.local/share/krita/paintoppresets/テスト.kpp</name>
in linux, it becomes:
<name>~/AppData/Roaming/krita/paintoppresets\???.kpp</name>
in windows, while the file has the name:
~/AppData/Roaming/krita/paintoppresets\テスト.kpp (as seen from linux).

Therefore, the brush is not blacklisted.
Comment 2 Halla Rempt 2021-03-30 13:29:30 UTC
This is fixed in master. Tested with 72f75a29c2.
Comment 3 Halla Rempt 2021-03-30 13:30:18 UTC
*** Bug 430448 has been marked as a duplicate of this bug. ***