termbox-go icon indicating copy to clipboard operation
termbox-go copied to clipboard

When I update termbox-go, it can't print chinese or Japanese.

Open dacez opened this issue 10 years ago • 10 comments

dacez avatar Mar 05 '15 02:03 dacez

I'm waiting a pull request from this guy: https://github.com/nsf/termbox-go/pull/69

But apparently he's gone somewhere.

nsf avatar Mar 05 '15 05:03 nsf

Just merged this pull request: https://github.com/nsf/termbox-go/pull/74

Does it work now?

nsf avatar Mar 17 '15 00:03 nsf

i wil try later thx very much!

dacez avatar Mar 18 '15 02:03 dacez

gomatrix still prints the japanese kana's correctly at termbox-go 10f14d7408b64a659b7c694a771f5006952d336c

GeertJohan avatar Mar 18 '15 11:03 GeertJohan

Looking good!

mattn avatar Mar 18 '15 12:03 mattn

:smile: :+1:

GeertJohan avatar Mar 18 '15 12:03 GeertJohan

It can print chinese too

dacez avatar Mar 26 '15 02:03 dacez

i am using this function to print chinese character. the key problem is the width of chinese rune.

it's a quick workaround.

func print_tb(x, y int, fg, bg termbox.Attribute, msg string) { for _, c := range msg { //fmt.Printf("%d ", utf8.RuneLen(c)) termbox.SetCell(x, y, c, fg, bg) if utf8.RuneLen(c) > 1 { //handle chinese rune x += 2 } else { x++ } } }

ericwq avatar Apr 22 '15 05:04 ericwq

utf8.RuneLen(c) doesn't represent cell's width. Use @mattn's library for that: https://github.com/mattn/go-runewidth

nsf avatar Apr 22 '15 05:04 nsf

thanks, i already done that.

ericwq avatar Apr 23 '15 04:04 ericwq