diff --git a/packages/core/src/tool/plugin/read.ts b/packages/core/src/tool/plugin/read.ts index 1259dc81f8e..541889d8dcb 100644 --- a/packages/core/src/tool/plugin/read.ts +++ b/packages/core/src/tool/plugin/read.ts @@ -135,9 +135,14 @@ export const Plugin = { .pipe(Effect.orDie) const alternatePath = Effect.fn("ReadTool.alternatePath")(function* (absolute: string) { - const base = basename(absolute).replace(/[\u00a0\u202f]/g, " ") + const canonical = (name: string) => + name + .normalize("NFC") + .replace(/[\u00a0\u202f]/g, " ") + .replace(/[\u2018\u2019]/g, "'") + const base = canonical(basename(absolute)) const matches = (yield* reader.list(AbsolutePath.make(dirname(absolute)))).filter( - (entry) => entry.type === "file" && entry.name.replace(/[\u00a0\u202f]/g, " ") === base, + (entry) => entry.type === "file" && canonical(entry.name) === base, ) if (matches.length !== 1) return return join(dirname(absolute), matches[0].name)