diff --git a/src/notifications.rs b/src/notifications.rs index fe3421d..14f35d9 100644 --- a/src/notifications.rs +++ b/src/notifications.rs @@ -164,9 +164,12 @@ impl NotificationManager { // Beautify media labels with emojis let beautified = Self::beautify_media_labels(text); - // Limit preview length - if beautified.len() > 150 { - format!("{}...", &beautified[..147]) + // Limit preview length (use char count, not byte count for UTF-8 safety) + const MAX_PREVIEW_CHARS: usize = 147; + let char_count = beautified.chars().count(); + if char_count > MAX_PREVIEW_CHARS { + let truncated: String = beautified.chars().take(MAX_PREVIEW_CHARS).collect(); + format!("{}...", truncated) } else { beautified }