Skip to content

Conversation

@Yundi339
Copy link

@Yundi339 Yundi339 commented Oct 30, 2025

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.

English ASCII characters (0x00–0x7F) are identical in all common encodings:
English : Open Sunshine
UTF-8: 4F 70 65 6E 20 53 75 6E 73 68 69 6E 65
GBK: 4F 70 65 6E 20 53 75 6E 73 68 69 6E 65
ASCII: 4F 70 65 6E 20 53 75 6E 73 68 69 6E 65

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

Fix formatting and memory allocation in tray_windows.c

Fix formatting and memory allocation in tray_windows.c

fix: windows messy code
@sonarqubecloud
Copy link

@ReenigneArcher
Copy link
Member

Why did you close #73 ?

@Yundi339
Copy link
Author

Why did you close #73 ?

Yes, I closed it. Sorry~~
My intention was to reopen the PR once the git force push was successful. However, I've since found out that GitHub does not allow a closed Pull Request to be reopened after its history has been forcefully overwritten.

I'm still relatively unfamiliar with the Git force push process. I wanted to performing a commit squash and I closed the PR to temporarily stop the Action runs.

Thank you for your understanding.

@ReenigneArcher
Copy link
Member

I'm still relatively unfamiliar with the Git force push process. I wanted to performing a commit squash and I closed the PR to temporarily stop the Action runs.

Oh, no problem! We will also do a squash and merge when the PR is merged so it will end up as a single commit in the base branch.

I'm also manually approving the actions, so it's not a bother if you have new changes/commits.

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.

2 participants