replacing non ascii characters in wikipedia mode when language is english

closes #4447
This commit is contained in:
Miodec 2023-07-10 14:13:11 +02:00
parent 99a7972c13
commit 8b8d9ebf01

View file

@ -51,7 +51,7 @@ export async function getSection(language: string): Promise<Section> {
// 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<Section> {
// 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(