From 434648a4b6cadd14e90af6d26c19b904e97096a4 Mon Sep 17 00:00:00 2001 From: overtrue Date: Thu, 1 Aug 2024 16:09:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20=E7=90=A2=20?= =?UTF-8?q?=E7=9A=84=E9=9F=B3=E9=A2=91=E9=A1=BA=E5=BA=8F=20#207?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/words-7.php | 2 +- sources/pathes/chars.txt | 1 + src/Converter.php | 2 +- tests/PinyinTest.php | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/data/words-7.php b/data/words-7.php index 4d752a4e..79878225 100644 --- a/data/words-7.php +++ b/data/words-7.php @@ -6284,7 +6284,7 @@ '琟' => ' wéi ', '琠' => ' tiǎn ', '琡' => ' chù ', - '琢' => ' zuó ', + '琢' => ' zhuó ', '琣' => ' běng ', '琤' => ' chēng ', '琥' => ' hǔ ', diff --git a/sources/pathes/chars.txt b/sources/pathes/chars.txt index bda0758f..04dceebd 100644 --- a/sources/pathes/chars.txt +++ b/sources/pathes/chars.txt @@ -1,2 +1,3 @@ U+55EF: ǹ # 嗯 U+2E81: fǎn # ⺁ +U+7422: zhuó,zuó # 琢 diff --git a/src/Converter.php b/src/Converter.php index a892df42..ef90d2ed 100644 --- a/src/Converter.php +++ b/src/Converter.php @@ -175,7 +175,7 @@ public function when(bool $condition, callable $callback): static return $this; } - public function convert(string $string, ?callable $beforeSplit = null): Collection + public function convert(string $string, callable $beforeSplit = null): Collection { // 把原有的数字和汉字分离,避免拼音转换时被误作声调 $string = preg_replace_callback('~[a-z0-9_-]+~i', function ($matches) { diff --git a/tests/PinyinTest.php b/tests/PinyinTest.php index 3810be4b..20783534 100755 --- a/tests/PinyinTest.php +++ b/tests/PinyinTest.php @@ -414,6 +414,9 @@ public function test_issues() // https://github.com/overtrue/pinyin/issues/200 $this->assertPinyin(['pú', 'ōu'], Pinyin::sentence('仆区')); + // https://github.com/overtrue/pinyin/issues/207 + $this->assertPinyin(['zhuó'], Pinyin::sentence('琢')); + // https://github.com/overtrue/pinyin/issues/195 $this->assertSame([ '你' => ['ni3'],