From 361760be0ac4304038457ca51aa135aa4bf6acaf Mon Sep 17 00:00:00 2001 From: Jaspann Date: Sun, 19 Dec 2021 20:33:55 -0500 Subject: [PATCH 1/2] Allows multilingual support in hashtags --- .../newpipe/util/external_communication/TextLinkifier.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java b/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java index f435653b5..92bdf879d 100644 --- a/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java +++ b/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java @@ -33,7 +33,8 @@ import static org.schabi.newpipe.util.external_communication.InternalUrlsHandler public final class TextLinkifier { public static final String TAG = TextLinkifier.class.getSimpleName(); - private static final Pattern HASHTAGS_PATTERN = Pattern.compile("(#[A-Za-z0-9_]+)"); + private static final Pattern HASHTAGS_PATTERN = + Pattern.compile("(#[A-Za-z0-9_\\u0080-\\uFFFF]+)"); private TextLinkifier() { } From a274baf5cda538e03b9089752ba3dd936971ec64 Mon Sep 17 00:00:00 2001 From: Jaspann Date: Mon, 20 Dec 2021 14:13:40 -0500 Subject: [PATCH 2/2] Adds comment to HASHTAGS_PATTERN --- .../newpipe/util/external_communication/TextLinkifier.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java b/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java index 92bdf879d..8b8eb265b 100644 --- a/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java +++ b/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java @@ -33,8 +33,9 @@ import static org.schabi.newpipe.util.external_communication.InternalUrlsHandler public final class TextLinkifier { public static final String TAG = TextLinkifier.class.getSimpleName(); + // Looks for hashtags with characters from any language (\p{L}), numbers, or underscores private static final Pattern HASHTAGS_PATTERN = - Pattern.compile("(#[A-Za-z0-9_\\u0080-\\uFFFF]+)"); + Pattern.compile("(#[\\p{L}0-9_]+)"); private TextLinkifier() { }