rthornton128 / goncurses

NCurses Library for Go
Other
383 stars 51 forks source link

UTF-8 support is wrong #64

Closed vit1251 closed 2 years ago

vit1251 commented 2 years ago

Example:

package main

import (
        "github.com/rthornton128/goncurses"
        "log"
        "time"
)

func main() {

        stdscr, err1 := goncurses.Init()
        if err1 != nil {
                log.Fatal("init:", err1)
        }
        defer goncurses.End()

        err2 := goncurses.StartColor()
        if err2 != nil {
                log.Fatal("StartColor", err2)
        }

        /* Box Drawing unicode example */
        stdscr.Print("┌─ Title ──────────────────────┐")
        stdscr.Print("│                              │")
        stdscr.Print("└──────────────────────────────┘")
        stdscr.Refresh()

        time.Sleep(1 * time.Minute)

}

Result:

image

rthornton128 commented 2 years ago

goncurses is not configured to allow for UTF-8. First, you need to make sure the locale is set correctly (out of scope of this project) and second, goncurses would need to be linked against lncursesw for the wide character version of the library. You should be able to clone this repo and make those changes to try it.

I think there may be a case to be made to link to the wide character library by default since Go supports utf-8 out of box.

vit1251 commented 2 years ago

You should be able to clone this repo and make those changes to try it.

Yep. Already do in https://github.com/vit1251/goncurses I change name on go-ncursesw later to avoid search engine is ambiguous results by name.

vit1251 commented 2 years ago

Rename complete in https://github.com/vit1251/go-ncursesw

rthornton128 commented 2 years ago

I've added a wiki page detailing what may be necessary for others who are also looking for UTF-8 support. https://github.com/rthornton128/goncurses/wiki/Internationalization-(I18n)