[PR #24] [MERGED] Fix truncation code to handle emojis with a actual width greater than one character. Example: 🎧 #31

Closed
opened 2026-02-27 20:07:47 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/misiektoja/spotify_profile_monitor/pull/24
Author: @tomballgithub
Created: 7/8/2025
Status: Merged
Merged: 7/10/2025
Merged by: @misiektoja

Base: devHead: truncate_fix


📝 Commits (2)

  • a4377cc Fix truncation code to handle emojis with a actual width greater than one character. Example: 🎧
  • 583366b Instantiate wcwidth

📊 Changes

2 files changed (+17 additions, -4 deletions)

View changed files

📝 requirements.txt (+1 -0)
📝 spotify_profile_monitor.py (+16 -4)

📄 Description

I noticed today that the truncation code doesn't cover the case when some emojis take up two character positions (they are double-wide). An example is the following, which was in the title of a playlist in my log: 🎧

This code does a character-by-character analysis and accounts for this.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/misiektoja/spotify_profile_monitor/pull/24 **Author:** [@tomballgithub](https://github.com/tomballgithub) **Created:** 7/8/2025 **Status:** ✅ Merged **Merged:** 7/10/2025 **Merged by:** [@misiektoja](https://github.com/misiektoja) **Base:** `dev` ← **Head:** `truncate_fix` --- ### 📝 Commits (2) - [`a4377cc`](https://github.com/misiektoja/spotify_profile_monitor/commit/a4377ccab4a8c17a0ce06fc6680f9257b31ad234) Fix truncation code to handle emojis with a actual width greater than one character. Example: 🎧 - [`583366b`](https://github.com/misiektoja/spotify_profile_monitor/commit/583366b3467b3cd6bbfde014d01777821137e92e) Instantiate wcwidth ### 📊 Changes **2 files changed** (+17 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `requirements.txt` (+1 -0) 📝 `spotify_profile_monitor.py` (+16 -4) </details> ### 📄 Description I noticed today that the truncation code doesn't cover the case when some emojis take up two character positions (they are double-wide). An example is the following, which was in the title of a playlist in my log: 🎧 This code does a character-by-character analysis and accounts for this. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:07:47 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify_profile_monitor#31
No description provided.