Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering Issues on Windows #30

Closed
PrinnyRay opened this issue May 6, 2021 · 9 comments
Closed

Rendering Issues on Windows #30

PrinnyRay opened this issue May 6, 2021 · 9 comments

Comments

@PrinnyRay
Copy link

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?
7cf793398ba9c0f97cad7e956f9ccf1
baff54d81acc85835c65aadec4cdad6
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.

@PrinnyRay
Copy link
Author

and example code looks like this...
8fd1cfa217d3fe449de60ebdbb8eb29

@meowgorithm
Copy link
Member

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.

@meowgorithm
Copy link
Member

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?

windows

@PrinnyRay
Copy link
Author

PrinnyRay commented May 7, 2021

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
de6737b09518910aa36b822f11e3eef

@meowgorithm
Copy link
Member

meowgorithm commented May 7, 2021

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?

@PrinnyRay
Copy link
Author

I got this。。
96ba9e1e4b23369b9b2917a96fce297
88f38a31d5a050b757ac28f25070413

This always happens when encoding are not matching. You remind me that I'm not using unicode console, I'll check it.

@meowgorithm
Copy link
Member

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.

@PrinnyRay
Copy link
Author

Solved.
I changed the cmd encoding to utf-8 and layout looks perfect.
5ec04b148a08ddad8ec8015f4a5ae03
27a325752e0d86b646144a26ef0bc02
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.

@meowgorithm
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants