Browse Source

fix(common): Remove trademark symbols from normalized strings (#2447)

Gautier Darchen 2 years ago
parent
commit
9aac191e7e

+ 1 - 1
packages/common/src/normalize-string.spec.ts

@@ -25,7 +25,7 @@ describe('normalizeString()', () => {
     it('strips non-alphanumeric characters', () => {
         expect(normalizeString('hi!!!')).toBe('hi');
         expect(normalizeString('who? me?')).toBe('who me');
-        expect(normalizeString('!"£$%^&*()+[]{};:@#~?/,|\\><`¬\'=')).toBe('');
+        expect(normalizeString('!"£$%^&*()+[]{};:@#~?/,|\\><`¬\'=©®™')).toBe('');
     });
 
     it('allows a subset of non-alphanumeric characters to pass through', () => {

+ 1 - 1
packages/common/src/normalize-string.ts

@@ -8,6 +8,6 @@ export function normalizeString(input: string, spaceReplacer = ' '): string {
         .normalize('NFD')
         .replace(/[\u0300-\u036f]/g, '')
         .toLowerCase()
-        .replace(/[!"£$%^&*()+[\]{};:@#~?\\/,|><`¬'=‘’]/g, '')
+        .replace(/[!"£$%^&*()+[\]{};:@#~?\\/,|><`¬'=‘’©®™]/g, '')
         .replace(/\s+/g, spaceReplacer);
 }