From 8b8d9ebf01896dcf3789be0ec2508f11561bf6c0 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 10 Jul 2023 14:13:11 +0200 Subject: [PATCH] replacing non ascii characters in wikipedia mode when language is english closes #4447 --- frontend/src/ts/test/wikipedia.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/ts/test/wikipedia.ts b/frontend/src/ts/test/wikipedia.ts index 289f4320c..64fbbd614 100644 --- a/frontend/src/ts/test/wikipedia.ts +++ b/frontend/src/ts/test/wikipedia.ts @@ -51,7 +51,7 @@ export async function getSection(language: string): Promise
{ // get TLD for wikipedia according to language group let urlTLD = "en"; - let currentLanguageGroup; + let currentLanguageGroup: MonkeyTypes.LanguageGroup | undefined; try { currentLanguageGroup = await Misc.findCurrentGroup(language); } catch (e) { @@ -109,6 +109,10 @@ export async function getSection(language: string): Promise
{ // Removing whitespace before and after text sectionText = sectionText.trim(); + if (urlTLD === "en") { + sectionText = sectionText.replace(/[^\x20-\x7E]+/g, ""); + } + const words = sectionText.split(" "); const section = new Section(