Repository: platers/obsidian-linter (ts)

Issue:
Bug: incorrect/spurious transformation être → êtree.
## Describe the Bug

When a text contains "être", this word is **transformed into "êtree"**, which is **incorrect** (in French).

## How to Reproduce

Steps to reproduce the behavior:

0. Make sure that "**Auto-correct common misspellings**" is On in the Linter settings.
1. Type "être" in a note.
2. Launch the linter.

## Expected Behavior

The word "être" should instead not be touched.

## Device

- [X] Desktop
- Mobile not tested


Pull request:
Fix Unicode Issue with Autocorrect
Fixes #633 

When checking for words to autocorrect, make sure unicode is supported since `\w` is not unicode aware.

Changes Made:
- Updated the regex in order to include unicode values as well
- Added a test to make sure it would not happen where the scenario in question happens again

Patch:
diff --git a/src/rules/auto-correct-common-misspellings.ts b/src/rules/auto-correct-common-misspellings.ts
index 2287ccd..5eeecf9 100644
--- a/src/rules/auto-correct-common-misspellings.ts
+++ b/src/rules/auto-correct-common-misspellings.ts
@@ -23,7 +23,7 @@ export default class AutoCorrectCommonMisspellings extends RuleBuilder<AutoCorre
   }
   apply(text: string, options: AutoCorrectCommonMisspellingsOptions): string {
     return ignoreListOfTypes([IgnoreTypes.yaml, IgnoreTypes.code, IgnoreTypes.inlineCode, IgnoreTypes.math, IgnoreTypes.inlineMath, IgnoreTypes.link, IgnoreTypes.wikiLink, IgnoreTypes.tag, IgnoreTypes.image, IgnoreTypes.url], text, (text) => {
-      const wordRegex = /[\w\-'’`]+/g;
+      const wordRegex = /[\p{L}\p{N}\p{Pc}\p{M}\-'’`]+/gu;
 
       return text.replaceAll(wordRegex, (word: string) => {
         const lowercasedWord = word.toLowerCase();


Test patch:
diff --git a/__tests__/auto-correct-common-misspellings.test.ts b/__tests__/auto-correct-common-misspellings.test.ts
index 1ec9f89..469ad84 100644
--- a/__tests__/auto-correct-common-misspellings.test.ts
+++ b/__tests__/auto-correct-common-misspellings.test.ts
@@ -27,5 +27,14 @@ ruleTest({
         ![absoltely not a changed](absoltely.not.changed.md)
       `,
     },
+    {
+      testName: 'Doesn\'t auto-correct words that start with unicode specific characters when not in correction list',
+      before: dedent`
+        être
+      `,
+      after: dedent`
+        être
+      `,
+    },
   ],
 });