mozillazg / go-pinyin

汉字转拼音
https://godoc.org/github.com/mozillazg/go-pinyin
MIT License
1.62k stars 195 forks source link

重写Fallback Bug #35

Closed drchen00 closed 4 years ago

drchen00 commented 5 years ago
func main() {
    a := pinyin.NewArgs()
    a.Separator = ""
    a.Style = pinyin.FIRST_LETTER
    a.Fallback = func(r rune, a pinyin.Args) []string {
        return []string{string(r)}
    }
    var s string = "重。,a庆"
    p := pinyin.Pinyin(s, a)
    fmt.Println(p)
}

输出:[[z] [�] [,] [a] [q]] 重写Fallback返回原值后中文标点符号会受到音调处理等影响变成乱码,对于Fallback产生的值不应该进行风格化处理

mozillazg commented 5 years ago

@drchen00 感谢反馈~ 待我有空的时候看看。欢迎提交 PR~