mattn / go-runewidth

wcwidth for golang
MIT License
610 stars 94 forks source link

`─` not expect #69

Closed lysShub closed 1 year ago

lysShub commented 1 year ago
func main() {
    b := `─` // unicode 0x2500
    fmt.Println(runewidth.StringWidth(b))
}

on windows/mac get: 2 on linux get: 1

mattn commented 1 year ago

What is your CodePage on Windows? LANG on Linux?

lysShub commented 1 year ago

@mattn

Windows

>chcp 
活动代码页: 936

Linux (wsl2) :

# echo $LANG
C.UTF-8
mattn commented 1 year ago

Yes, go-runewidth return 2 for on CJK locales.

mattn commented 1 year ago

If you don't want that go-runewidth detect locales, set RUNEWIDTH_EASTASIAN=0