Skip to content

Commit

Permalink
fix: 土耳其字符 İ 转小写后变成两个字符导致长度对不上 #72
Browse files Browse the repository at this point in the history
  • Loading branch information
lazyloong committed Dec 16, 2024
1 parent 6b6a5bb commit ce422cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"author": "lazyloong",

"minAppVersion": "1.0.0",
"version": "2.27.13"
"version": "2.27.14"
}
9 changes: 8 additions & 1 deletion src/utils/pinyin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ export class Pinyin extends Array<PinyinChild> {
try {
result = this.matchAboveStart(f(this.text), f(pinyin));
} catch (e) {
console.log(this, pinyin);
// 土耳其字符 "İ" 转小写后变成两个字符("i"和附加的点下加符号 "̇")导致长度对不上
if (this.text.includes("İ")) {
const f = (str: string) => (smathCase ? str : str.toLocaleLowerCase("tr"));
result = this.matchAboveStart(f(this.text), f(pinyin));
} else {
console.log(this.text, pinyin, this);
throw e;
}
}
return result;
}
Expand Down

0 comments on commit ce422cd

Please sign in to comment.