diff --git a/frontend/__tests__/utils/strings.spec.ts b/frontend/__tests__/utils/strings.spec.ts index 01bcd6f441b1..160816efb7b5 100644 --- a/frontend/__tests__/utils/strings.spec.ts +++ b/frontend/__tests__/utils/strings.spec.ts @@ -160,6 +160,17 @@ describe("string utils", () => { expect(Strings.splitIntoCharacters("t𐑩e")).toEqual(["t", "𐑩", "e"]); }); }); + describe("cleanTypographySymbols", () => { + it.each([ + ["„Hallo“", '"Hallo"'], + ["ἀπ᾽", "ἀπ'"], + ["„one“ „two“ ᾽᾽", '"one" "two" \'\''], + ["plain text, 123!", "plain text, 123!"], + ])("converts %s to %s", (input, expected) => { + expect(Strings.cleanTypographySymbols(input)).toBe(expected); + }); + }); + describe("replaceControlCharacters", () => { it.each([ // Basic tab conversions diff --git a/frontend/src/ts/utils/strings.ts b/frontend/src/ts/utils/strings.ts index 1dba0722794e..d93e31c91754 100644 --- a/frontend/src/ts/utils/strings.ts +++ b/frontend/src/ts/utils/strings.ts @@ -190,7 +190,7 @@ export function cleanTypographySymbols(textToClean: string): string { "᾽": "'", }; return textToClean.replace( - /[“”’‘—,…«»–\u2007\u202F\u00A0]/g, + /[“”„’‘᾽—,…«»–\u2007\u202F\u00A0]/g, (char) => specials[char as keyof typeof specials] || "", ); }