rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

Unsupported Unicodes on Windows 10 #88

Closed pranjal-joshi closed 3 years ago

pranjal-joshi commented 3 years ago

Hello,

My code with smooth bar and waves spinner works well on Ubuntu.

However, the same code on Windows 10 shows incorrect output due to the Unicode issue.

alive_issue

Please suggest a workaround for this!

rsalmei commented 3 years ago

Hello @pranjal-joshi,

Yeah, those square blocks are weird, but it's odd. I had a similar question recently, that on Windows it wasn't showing control characters, but Unicode was OK (in #83)... Which font are you using on your terminal? Are you sure it does contain Unicode chars?

pranjal-joshi commented 3 years ago

Thanks for the quick help!

I went through #83. Currently, I am using Monaco font with my Command Prompt. However, I tried all of the font option available for cmd but everytime I am getting different kind of blocks but not the desired result.

TheTechRobo commented 3 years ago

Could you try it in the new windows terminal?

The square blocks typically mean it's not a good font. Try installing a nerd font.

rsalmei commented 3 years ago

Yes, that's a great suggestion! I use nerd fonts myself, have several installed like Hack, FiraCode, Source Code Pro, Dejavu, VictorMono, etc. These fonts should always have all exotic characters you'd ever need.

pranjal-joshi commented 3 years ago

@rsalmei @TheTechRobo

I'm shipping my application binaries using pyinstaller. Is it possible to ship one of the Nerd Font with it and automatically set it console font?

TheTechRobo commented 3 years ago

I don't think so, unless you bundle a full-on terminal with it. :/

Font choice is set by the console, not the program, sadly.

Did Nerd fonts work? If so, you could always simply suggest it, saying that if it doesn't work try the nerd font...

In any case it's not horrible, they'll just see little squares instead of bits of the progress bar.

pranjal-joshi commented 3 years ago

Sure! I will try more about packing font in the executable. I will reopen and update if I found a way to do it. meanwhile, I just use the following code to avoid bad-looking blocks:

    import platform
    bar = 'smooth'
    spinner = 'waves'
    if 'Windows' in platform.platform():
        bar = 'classic2'
        spinner = 'dots_recur'
    with alive_bar(numStocks,bar=bar,spinner=spinner) as progressbar:
        # Do some stuff here
        progressbar()

Thank you both for quick support! 😃