wtfutil / wtf

The personal information dashboard for your terminal
http://wtfutil.com
Mozilla Public License 2.0
15.74k stars 799 forks source link

Make Error: character set not supported (Cygwin) #367

Closed E3V3A closed 5 years ago

E3V3A commented 5 years ago

Following procedure in #350 results in the weird error: Error: character set not supported

$ make run
go build -o bin/wtf
bin/wtf
C:\Users\XXXX\.config\wtf\config.yml
Error: character set not supported
make: *** [Makefile:35: run] Error 1

However, the binaries run fine anyway!

System: Cygwin/POSIX

How can I help debug?

senorprogrammer commented 5 years ago

Take a look at this thread, it might help. If it does or doesn't let me know: https://github.com/wtfutil/wtf/issues/225

E3V3A commented 5 years ago

As @gdamore said:

Tcell, and hence wtf, won’t work with mingw inside mintty.

However, another user stated it was "working" in Zsh, but now I'm wondering if he was actually running Zsh in ConEmu. If there is no work-around to what gdamore said, then we can close this issue as not supported / won't fix.

E3V3A commented 5 years ago

I followed @mapitman hint of adding UTF-16 to the tcell/encoding.go file:


func init() {
    // We always support UTF-8 and ASCII.
    encodings = make(map[string]encoding.Encoding)
    encodings["utf-8"] = gencoding.UTF8
    encodings["utf8"] = gencoding.UTF8
    encodings["utf-16"] = gencoding.UTF8
    encodings["utf16"] = gencoding.UTF8
    encodings["utf-16UL"] = gencoding.UTF8
    encodings["us-ascii"] = gencoding.ASCII
    encodings["ascii"] = gencoding.ASCII
    encodings["iso646"] = gencoding.ASCII
}

This resulted in a new error: Error: no suitable screen available, but still runs in all Windows consoles. However, interestingly using Cygwin with:

TERM="" ./wtf.exe

starts without error, but doesn't show anything, just hanging. This is actually good news. (No news is good news!) So something is happening and running somewhere.

Similarly starting the following in PS results in the same error:

$env:TERM='xterm'
.\bin\wtf.exe
E3V3A commented 5 years ago

Just FYI and from Cygwin FAQ:

  • 4.18 Why don't international (Unicode) characters work?

Internationalization is a complex issue. The short answer is that Cygwin relies on the setting of the setting of LANG/LC_xxx environment variables. The long answer can be found in the User's Guide in the section Internationalization

Cygwin uses UTF-8 by default. To use a different character set, you need to set the LC_ALL, LC_CTYPE or LANG environment variables.

  • 4.19 My application prints international characters but I only see gray boxes

In the case of Cygwin programs, this likely means that the character set as determined by the LC_ALL, LC_CTYPE or LANG environment variables does not match the one set on the Text page of the Cygwin Terminal's options. Setting the locale in the terminal's options will set the LANG variable accordingly.

Non-Cygwin programs in the Cygwin Terminal do not usually take heed of the locale environment variables. Instead, they often use the so-called console codepage, which can be determined with the command:
cmd /c chcp <codepage>
followed by the appropriate Windows codepage number. The codepage number for Cygwin's default UTF-8 character set is 65001.

E3V3A commented 5 years ago

Closing for now, as this is a bug of tcell. and not WTF.

E3V3A commented 5 years ago

There might have been some updates to tcell according to:

senorprogrammer commented 5 years ago

Good to hear. I'll update the tcell dependency and bring that in.

senorprogrammer commented 5 years ago

tcell has been updated to the latest and is in master.