Bug 453637 - Chinese name patterns in kra and bundles are displayed incorrectly.
Summary: Chinese name patterns in kra and bundles are displayed incorrectly.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (other bugs)
Version First Reported In: 5.0.6
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-10 19:14 UTC by Eranthis stellata Maxim
Modified: 2025-02-20 08:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eranthis stellata Maxim 2022-05-10 19:14:32 UTC
SUMMARY

Chinese name patterns in kra and bundles are displayed incorrectly.


STEPS TO REPRODUCE
1. Make a Chinese name pattern (.pat)
2. Save it into kra and make it into a bundle.
3. Open kra in brand new krita to see the name.
4. View the name after importing the bundle in brand new krita.

OBSERVED RESULT
Patterns do not display Chinese names correctly.

EXPECTED RESULT
Patterns correctly display Chinese names.

SOFTWARE/OS VERSIONS
Krita

 Version: 5.0.6
 Installation type: installer / portable package
 Languages: en_US, en, en_US, en, en_US, en, en_US, en, en_US, en, en_US, en, en_US, en, en_US, en, zh_CN, zh, en_US, en
 Hidpi: true

Qt

  Version (compiled): 5.12.12
  Version (loaded): 5.12.12

OS Information

  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.19042
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10

OpenGL Info
 
  Vendor:  "Google Inc." 
  Renderer:  "ANGLE (NVIDIA GeForce GTX 970 Direct3D11 vs_5_0 ps_5_0)" 
  Version:  "OpenGL ES 3.0 (ANGLE 2.1.0.57ea533f79a7)" 
  Shading language:  "OpenGL ES GLSL ES 3.00 (ANGLE 2.1.0.57ea533f79a7)" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
     Version: 3.0
     Supports deprecated functions false 
     is OpenGL ES: true 
  supportsBufferMapping: true 
  supportsBufferInvalidation: false 
  Extensions: 
     "GL_OES_depth32" 
     "GL_OES_texture_half_float" 
     "GL_ANGLE_client_arrays" 
     "GL_KHR_debug" 
     "GL_ANGLE_multiview" 
     "GL_NV_pack_subimage" 
     "GL_OES_texture_float_linear" 
     "GL_CHROMIUM_sync_query" 
     "GL_NV_EGL_stream_consumer_external" 
     "GL_EXT_texture_storage" 
     "GL_OES_vertex_array_object" 
     "GL_OES_standard_derivatives" 
     "GL_ANGLE_robust_client_memory" 
     "GL_CHROMIUM_bind_generates_resource" 
     "GL_EXT_debug_marker" 
     "GL_ANGLE_texture_usage" 
     "GL_EXT_texture_rg" 
     "GL_ANGLE_program_cache_control" 
     "GL_ANGLE_framebuffer_multisample" 
     "GL_EXT_read_format_bgra" 
     "GL_ANGLE_framebuffer_blit" 
     "GL_OES_rgb8_rgba8" 
     "GL_ANGLE_texture_compression_dxt3" 
     "GL_OES_element_index_uint" 
     "GL_NV_fence" 
     "GL_CHROMIUM_copy_compressed_texture" 
     "GL_EXT_draw_buffers" 
     "" 
     "GL_CHROMIUM_bind_uniform_location" 
     "GL_OES_texture_npot" 
     "GL_OES_EGL_image_external" 
     "GL_EXT_shader_texture_lod" 
     "GL_EXT_texture_compression_dxt1" 
     "GL_EXT_robustness" 
     "GL_EXT_texture_filter_anisotropic" 
     "GL_EXT_texture_format_BGRA8888" 
     "GL_OES_get_program_binary" 
     "GL_EXT_map_buffer_range" 
     "GL_OES_packed_depth_stencil" 
     "GL_CHROMIUM_color_buffer_float_rgb" 
     "GL_EXT_color_buffer_half_float" 
     "GL_OES_surfaceless_context" 
     "GL_EXT_color_buffer_float" 
     "GL_ANGLE_request_extension" 
     "GL_EXT_sRGB" 
     "GL_OES_EGL_image_external_essl3" 
     "GL_EXT_frag_depth" 
     "GL_OES_texture_float" 
     "GL_NV_pixel_buffer_object" 
     "GL_EXT_discard_framebuffer" 
     "GL_EXT_occlusion_query_boolean" 
     "GL_EXT_unpack_subimage" 
     "GL_EXT_texture_compression_s3tc_srgb" 
     "GL_EXT_texture_norm16" 
     "GL_OES_texture_half_float_linear" 
     "GL_EXT_disjoint_timer_query" 
     "GL_ANGLE_depth_texture" 
     "GL_CHROMIUM_color_buffer_float_rgba" 
     "GL_EXT_blend_minmax" 
     "GL_CHROMIUM_copy_texture" 
     "GL_ANGLE_instanced_arrays" 
     "GL_ANGLE_pack_reverse_row_order" 
     "GL_OES_EGL_image" 
     "GL_OES_compressed_ETC1_RGB8_texture" 
     "GL_ANGLE_texture_compression_dxt5" 
     "GL_ANGLE_translated_shader_source" 
     "GL_OES_mapbuffer" 
     "GL_ANGLE_lossy_etc_decode" 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsAngleD3D11: true 
  isQtPreferAngle: true 

useBufferInvalidation (config option): false


Hardware Information

  GPU Acceleration: auto
  Memory: 32693 Mb
  Number of Cores: 16
  Swap Location: C:/Users/xi/AppData/Local/Temp

Current Settings

  Current Swap Location: C:/Users/xi/AppData/Local/Temp
  Current Swap Location writable: true
  Undo Enabled: true
  Undo Stack Limit: 200
  Use OpenGL: true
  Use OpenGL Texture Buffer: true
  Disable Vector Optimizations: false
  Disable AVX Optimizations: false
  Canvas State: OPENGL_SUCCESS
  Autosave Interval: 420
  Use Backup Files: true
  Number of Backups Kept: 1
  Backup File Suffix: ~
  Backup Location: Same Folder as the File
  Backup Location writable: false
  Use Win8 Pointer Input: false
  Use RightMiddleTabletButton Workaround: false
  Levels of Detail Enabled: false
  Use Zip64: false


Display Information
Number of screens: 2
	Screen: 0
		Name: \\.\DISPLAY1
		Depth: 32
		Scale: 1
		Resolution in pixels: 2560x1440
		Manufacturer: 
		Model: 
		Refresh Rate: 59
	Screen: 1
		Name: \\.\DISPLAY2
		Depth: 32
		Scale: 1
		Resolution in pixels: 1920x1080
		Manufacturer: 
		Model: 
		Refresh Rate: 60


---------------------
================================================================================
SESSION: 11 May 2022 02:50:06 +0800. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 5.0.6, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 2408
-- -- -- -- -- -- -- --
11 May 2022 02:50:06 +0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
11 May 2022 02:50:07 +0800: Creating database from scratch (database didn't exist, new schema version: 0.0.16).
11 May 2022 02:50:20 +0800: Non-store package - creating updater
11 May 2022 02:50:29 +0800: Created image "未命名", 2480 * 3508 pixels, 300 dpi. Color model: 8 位整数/通道 RGB/透明度 (sRGB-elle-V2-srgbtrc.icc). Layers: 2
11 May 2022 02:50:35 +0800: CLOSING SESSION
================================================================================
SESSION: 11 May 2022 02:50:45 +0800. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 5.0.6, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 2576
-- -- -- -- -- -- -- --
11 May 2022 02:50:45 +0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
11 May 2022 02:50:46 +0800: Database is up to date. Version: 0.0.16, created by Krita 5.0.6, at 周三 5月 11 02:50:07 2022
11 May 2022 02:50:48 +0800: Non-store package - creating updater
11 May 2022 02:51:02 +0800: Created image "未命名", 2480 * 3508 pixels, 300 dpi. Color model: 8 位整数/通道 RGB/透明度 (sRGB-elle-V2-srgbtrc.icc). Layers: 2
11 May 2022 02:51:31 +0800: Created image "未命名", 2480 * 3508 pixels, 300 dpi. Color model: 8 位整数/通道 RGB/透明度 (sRGB-elle-V2-srgbtrc.icc). Layers: 2
11 May 2022 02:51:56 +0800: Saving Document  as C:/Users/xi/Desktop/1.kra (mime: application/x-krita). 2480 * 3508 pixels, 4 layers.  101 frames, 24 framerate. Export configuration: No configuration
11 May 2022 02:51:56 +0800: Converting from application/x-krita to application/x-krita. Location: C:/Users/xi/Desktop/1.kra. Real location: C:/Users/xi/Desktop/1.kra. Batchmode: 0. Configuration: none
11 May 2022 02:51:56 +0800: Completed saving C:/Users/xi/Desktop/1.kra (mime: application/x-krita). Result: OK. Warning: . Size: 4243867
11 May 2022 02:51:56 +0800: Saving Completed
11 May 2022 02:52:24 +0800: CLOSING SESSION
================================================================================
SESSION: 11 May 2022 02:52:26 +0800. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 5.0.6, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 2628
-- -- -- -- -- -- -- --
11 May 2022 02:52:26 +0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
11 May 2022 02:52:27 +0800: Database is up to date. Version: 0.0.16, created by Krita 5.0.6, at 周三 5月 11 02:50:07 2022
11 May 2022 02:52:29 +0800: Non-store package - creating updater

---------------------
Comment 1 Halla Rempt 2023-06-15 11:57:47 UTC
In the database, the name is broken, but the filename is correct.
Comment 2 Dmitry Kazakov 2025-02-20 08:34:58 UTC
Git commit e29cf8b578c177a7090e9301c2cf0e7a871d5ba7 by Dmitry Kazakov, on behalf of Nicholas LaPointe.
Committed on 20/02/2025 at 08:34.
Pushed by dkazakov into branch 'master'.

Treat pattern name as UTF-8 when loading a .pat resource

GIMP pattern names are stored as null-terminated UTF-8 strings, but we were
loading them as Latin-1.

References:
(UTF-8) https://developer.gimp.org/core/standards/pat/
(Null-termination) https://gitlab.gnome.org/GNOME/gimp/-/blob/127cd67118727ef9086c829e66b7894c72c2ef98/app/core/gimppattern-header.h#L42

M  +1    -1    libs/pigment/resources/KoPattern.cpp

https://invent.kde.org/graphics/krita/-/commit/e29cf8b578c177a7090e9301c2cf0e7a871d5ba7
Comment 3 Dmitry Kazakov 2025-02-20 08:37:24 UTC
Git commit 343b590224f9067ef436b9c543fe08944da9582b by Dmitry Kazakov.
Committed on 20/02/2025 at 08:37.
Pushed by dkazakov into branch 'krita/5.2'.

Treat pattern name as UTF-8 when loading a .pat resource

GIMP pattern names are stored as null-terminated UTF-8 strings, but we were
loading them as Latin-1.

References:
(UTF-8) https://developer.gimp.org/core/standards/pat/
(Null-termination) https://gitlab.gnome.org/GNOME/gimp/-/blob/127cd67118727ef9086c829e66b7894c72c2ef98/app/core/gimppattern-header.h#L42

(cherry picked from commit e29cf8b578c177a7090e9301c2cf0e7a871d5ba7)

Co-authored-by: Nicholas LaPointe <nicholaslapointe8@gmail.com>

M  +1    -1    libs/pigment/resources/KoPattern.cpp

https://invent.kde.org/graphics/krita/-/commit/343b590224f9067ef436b9c543fe08944da9582b