Closed PrinnyRay closed 3 years ago
and example code looks like this...
Thank you for the kind words on Lip Gloss and Bubble Tea!
And oh my, this looks quite odd. We'll investigate this shortly and get back to you. Thanks for flagging this.
Hi! I'm not able to produce this behavior on Windows (see the screenshot below showing Lip Gloss output in Windows Terminal, PowerShell standalone, and the legacy command console in Windows 10.
Are there any more details you can provide on your environment? In particular, Windows version, terminal font…and maybe locale?
My envs are: Windows 10 Pro for Workstations, Ver.2004 Build.19041 Windows terminal Font is Consolas 12pt and YaHei UI Legacy CMD is SimSun(I think Western Letter fallback is Times New Roman) And Goland IDE integrated Terminal is Fira Code 14pt(with default SimSun fallback) They are all using Command Line
I think this may be a font issue…but it's difficult to say. Could you try pasting this this into a text file:
╔═══════╗
║foo bar║
╚═══════╝
…and then running type filename.txt
to print it to the console?
I got this。。
This always happens when encoding are not matching. You remind me that I'm not using unicode console, I'll check it.
Cool, let me know! The other thing to double check is that all your fonts (including the fallbacks are monospaced fonts (and not proportional ones). In both cases it looks like your Latin fonts (and maybe your CJK ones as well) are proportional fonts.
Solved.
I changed the cmd encoding to utf-8 and layout looks perfect.
I guess the default charset for Windows with Simplified Chinese is GBK, and charset in windows is also called active console code page. For me it is 936 for default, that means I'm using GBK encoding.
Use chcp 65001
to change to utf-8 encoding according to this page.
I think if you run chcp 936
before you run the program, you would get the same result.
Awesome. This is really good to know. Thanks for the details on how you fixed it.
I’m going to close this issue, but feel free to open it back up if you notice any other odd behavior.
I found border rendering is very strange, I've tried on Windows Terminal and legacy CMD, both are missing some characters, am I missing some configs? Here is my code:
logo := "foo bar" fmt.Printf(lipgloss.NewStyle().BorderStyle(lipgloss.DoubleBorder()).Render(logo))
BTW, I love this lib and bubbletea. I'm trying to build a cli tool in go, your repo is the most elegant framework I've ever seen. Thanks for building this.