From 5920b26aabe50da04655c18a47f71713ab1121cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Thu, 25 Aug 2022 14:14:08 +0100 Subject: [PATCH] Do not remove newline and whitespace characters from notification content --- .../gadgetbridge/externalevents/NotificationListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java index 3244d247e..de6ca7d0f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java @@ -591,9 +591,10 @@ public class NotificationListener extends NotificationListenerService { } } - // Strip Unicode control sequences: some apps like Telegram add a lot of them for unknown reasons + // Strip Unicode control sequences: some apps like Telegram add a lot of them for unknown reasons. + // Keep newline and whitespace characters private String sanitizeUnicode(String orig) { - return orig.replaceAll("\\p{C}", ""); + return orig.replaceAll("[\\p{C}&&\\S]", ""); } private void dissectNotificationTo(Notification notification, NotificationSpec notificationSpec,