Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Emoji Progress Spinners

by parv (Parson)
on Feb 07, 2021 at 07:27 UTC ( [id://11128002]=note: print w/replies, xml ) Need Help??


in reply to Emoji Progress Spinners

Thanks, Ken.

On MS Windows 10, in PowerShell 7.0.2 command window (not cmd.exe), I see shit via Strawberry Perl ... well not quite. Its properties show "Unicode65001 UTF-8" codepage, with no obvious way to change that. Executing "bash.exe" did not change the behaviour much via WSL perl.

Then one way or another I came upon Windows Terminal in search of better Unicode support. PowerShell output was still crappy as before. But after executing "bash.exe", I could see proper clock & moon cycles. Finally!

Replies are listed 'Best First'.
Re^2: Emoji Progress Spinners
by soonix (Canon) on Nov 05, 2021 at 08:30 UTC
    Meanwhile, if I need Unicode output on a Windows console, I put the following near the top of the script:
    use Win32::Console; my $codepage = Win32::Console::OutputCP(); Win32::Console::OutputCP(65000); binmode STDOUT, ':encoding(cp65000)';
    AFAIK, these settings are per-process, otherwise I'd change this into a BEGIN block with a corresponding END block - that's why I saved the $codepage, you can discard this line if you don't need to restore it within the script.

      Thank you for the clue.

Re^2: Emoji Progress Spinners
by kcott (Archbishop) on Feb 07, 2021 at 11:31 UTC

    G'day parv,

    Following the link you provided, I see quite a fair way down the page, where it has an old vs. new comparison, it says about the "old":

    "... to maintain backward compatibility, we have been unable to add ... unicode text, and emoji."

    That possibly explains why your earlier attempts had problems. Also, if I recall correctly, MSWin uses UTF-16 natively; so that's just another fly in the ointment.

    I've never been a big fan of cmd.exe; I wasn't overly impressed with PowerShell when I first encountered it a couple of years ago; this Windows Terminal looks a bit more promising and I may try it out at some point — I'm not rushing to do that, but I did at least bookmark that link. I also have Win10, but I use Cygwin on top of that, so these MS shell issues are somewhat moot.

    Anyway, I'm pleased to see you finally got it working.

    — Ken

Re^2: Emoji Progress Spinners
by soonix (Canon) on Feb 08, 2021 at 15:27 UTC
    On my Windows 10 (Version 2004, although I was quite sure it were 20H2) if I chcp 65001, it looks OK.

    I'm calling Strawberry Perl via its "portableshell.bat" and then call powershell on top of it, but I assume chcp is more or less independent from the way it is invoked.

      soonix, that is good and surprising to read.

      Version of Windows 10 Home I have is 20H2, OS build 19042.746. "Use Legacy console" option has been turned off. My experiment in 5 kinds of console windows ...

      Powershell 7.0.2 (was listed as "PowerShell 7-x64" in "Control Panel: Programs and Feature")
      ran chcp, then portableshell.bat, perl.exe; printed was ...
      ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒòº
      ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒ≡ƒîæ
      
      Cmd
      an "improvement" is that cursor stays in place and "?" is displayed for both clock and moon.
      Windows Terminal; chosen from "Tasks" menu after right click on the icon ...
      Powershell (icon with black background)
      same as before
      Cmd
      (ran only chcp and perl) success with Strawberry Perl, not needed to use WSL.
      Windows PowerShell (icon with blue background)
      (ran only chcp and perl) success with Strawberry Perl

      Nested dl parsing seems to be busted here.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11128002]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-04-19 14:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found