Bug 447730

Summary: Cannot create a Chinese gradient in SVG format normally
Product: [Applications] krita Reporter: thetwo <thetwo222>
Component: Resource ManagementAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR Keywords: triaged
Version: 5.0.2   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: picture
bug

Description thetwo 2021-12-31 10:00:50 UTC
Created attachment 144985 [details]
picture

It appears garbled in the resource folder. However, it was normal on November 8.
Comment 1 thetwo 2022-03-06 05:21:55 UTC
Now this problem still exists, I tried Japanese, and a garbled file is also generated.
Normal files created in previous versions cannot be read normally too.
Comment 2 Halla Rempt 2022-03-08 12:26:18 UTC
I've tried to reproduce on Windows and on Linux, and I couldn't :-(
Comment 3 thetwo 2022-03-08 12:53:19 UTC
Created attachment 147365 [details]
bug

I tried turning off all plugins and using the nightly version, but the problem persists... 
As shown in the figure, if it is a mixed name of English + Chinese, then the English part is normal, and the Chinese becomes garbled.
Comment 4 Halla Rempt 2022-03-31 12:07:08 UTC
After installing a traditional chinese locale, I can reproduce the problem on Windows. Though it's pretty mysterious, because we use QString all along, and when we come to the place where we actually construct a QFile object, the filename suddenly is broken  -- but only for gradients, not for presets or palettes.
Comment 5 Halla Rempt 2022-03-31 12:29:40 UTC
Git commit 08ac5112a7bfabced5a8ab2252402df1f3fa980e by Halla Rempt.
Committed on 31/03/2022 at 12:29.
Pushed by rempt into branch 'master'.

Add temporary debug information

M  +8    -2    libs/resources/KisFolderStorage.cpp

https://invent.kde.org/graphics/krita/commit/08ac5112a7bfabced5a8ab2252402df1f3fa980e
Comment 6 Halla Rempt 2022-03-31 13:15:54 UTC
Git commit 959bf282a1b8e9f40acd3b10b696186c79164e0b by Halla Rempt.
Committed on 31/03/2022 at 13:15.
Pushed by rempt into branch 'master'.

Gradients: set the QTextStreadm codec to UTF-8

M  +2    -1    libs/pigment/resources/KoSegmentGradient.cpp
M  +1    -1    libs/pigment/resources/KoStopGradient.cpp

https://invent.kde.org/graphics/krita/commit/959bf282a1b8e9f40acd3b10b696186c79164e0b
Comment 7 Halla Rempt 2022-03-31 14:11:31 UTC
Okay, that last commit actually fixed the bug :-)
Comment 8 Halla Rempt 2022-03-31 14:12:35 UTC
Git commit b2560ddc1547d7b25db71569d5c3e794dce12a42 by Halla Rempt.
Committed on 31/03/2022 at 14:12.
Pushed by rempt into branch 'krita/5.0'.

Gradients: set the QTextStreadm codec to UTF-8
(cherry picked from commit 959bf282a1b8e9f40acd3b10b696186c79164e0b)

M  +2    -1    libs/pigment/resources/KoSegmentGradient.cpp
M  +1    -1    libs/pigment/resources/KoStopGradient.cpp

https://invent.kde.org/graphics/krita/commit/b2560ddc1547d7b25db71569d5c3e794dce12a42