opencc4j icon indicating copy to clipboard operation
opencc4j copied to clipboard

部份繁體字不能轉換至簡體字

Open smlam opened this issue 1 year ago • 0 comments

當使用 ZhConverterUtil.toSimple 轉換 兩餸飯 作簡體. 回傳的結果是 两 餸 饭 餸 字不能轉換至 𩠌.

追查一下 code. 發現 com.github.houbb.opencc4j.support.convert.core.impl.DefaultUnitConvert 中的 getPhraseResult function. 用了 result.length() == 1 檢查. 而 𩠌 字 result.length() 是 2 導致.

if(result.length() == 1) {
                stringBuilder.append(result);
            } else {
                //fixed34: 如果映射缺失,则返回本身
                stringBuilder.append(charStr);
            }

smlam avatar Nov 06 '25 03:11 smlam