Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: decode unicode escape sequences (fixes emojis, Chinese, etc) #6

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

yuhldr
Copy link
Contributor

@yuhldr yuhldr commented Oct 23, 2024

set the category name in Chinese so that notifications will be displayed as Unicode escape sequences. Other languages may also have this issue, and perhaps there are related problems in other parts of the project as well. I only modified the notification here

Showing: "Time yesterday - - All: 4h 16m
- Uncategorized: 2h 7m
- \u5de5\u4f5c: 2h 6m"  (aw_notify.main:154)
Showing: "Time yesterday - - All: 4h 18m
- Uncategorized: 2h 8m
- 工作: 2h 7m"  (aw_notify.main:154)

Important

Fixes Chinese character display issue in notifications by decoding Unicode escape sequences in main.py.

  • Behavior:
    • Fixes issue with Chinese characters in category names being displayed as Unicode escape sequences in notifications.
    • Modifies send_checkin in main.py to decode Unicode escape sequences using decode_unicode_escapes().
  • Functions:
    • Adds decode_unicode_escapes() to main.py to convert Unicode escape sequences to characters.

This description was created by Ellipsis for bd29ee5. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to bd29ee5 in 10 seconds

More details
  • Looked at 39 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. aw_notify/main.py:334
  • Draft comment:
    Ensure decode_unicode_escapes is used wherever category names are displayed or logged to prevent similar encoding issues.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The decode_unicode_escapes function is correctly implemented and used in the send_checkin function to decode category names. However, the PR description suggests that this issue might exist in other parts of the project as well. It's important to ensure that any other places where category names are displayed or logged also use this function to prevent similar issues.

Workflow ID: wflow_SO4OX2UiHahzeon0


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@sproclavism
Copy link

+1

This would potentially also fix emojis (in this example 📺 🌐 ❔)
image

aw_notify/main.py Outdated Show resolved Hide resolved
aw_notify/main.py Outdated Show resolved Hide resolved
@ErikBjare ErikBjare changed the title fix: Item name Chinese encoding fix: decode unicode escape sequences (fixes emojis, Chinese, etc) Nov 1, 2024
@ErikBjare ErikBjare merged commit b0be7c2 into ActivityWatch:master Nov 1, 2024
2 of 3 checks passed
@ErikBjare
Copy link
Member

Thank you very much!

Please let me know if you see raw unicode escape sequences anywhere else :)

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.

3 participants