Skip to content

Conversation

@Yundi339
Copy link

Description

Fix Windows menu and tray icon text appears Chinese garbled problem.

Older versions use ANSI APIs (MENUITEMINFO, Shell_Icon) resulting in a higher level of API usage when the system code page is GBK/CP936
If you enter a UTF-8 encoded string, garbled text appears.

This change switches to Unicode API:

  • Use MENUITEMINFOW, Shell_NotifyIconW
  • Convert UTF-8 to UTF-16 via MultiByteToWideChar before invocation
  • Solved the abnormal display problem of multi-language environment such as Chinese and Japanese.

Screenshot

After repair (normal display chinese):
33a1446b103252af4f95fc87519106a7

Issues Fixed or Closed

  • None

Roadmap Issues

  • None

Type of Change

  • fix: Bug fix (non-breaking change which fixes an issue)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • Moderate: AI helped with code generation or debugging specific parts

@Yundi339 Yundi339 changed the title fix: windows messy code fix(windows): incorrect UTF8/GBK string encoding handling Oct 29, 2025
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant