My Windows environment, 2018 edition

I think I’ve found a workable solution for Unicode support from a Windows command line. I’ve made various posts about editing tools in this blog but I hadn’t found one satisfactory. Sinan Ünür and I took another wack at configuring something to handle Unicode (mostly to support my work on Learning Perl 6) and I think we have something that works.

And I need these instructions because I’m not a regular Windows user. These notes are as much for me as they are for you. If you have other suggestions or a different environment that works let me know about it. I tend to stop when I have something that works. Previous posts are the Tools category.

Windows 10

In previous posts I was using Windows 7 or Windows 8. I’m simply not going to worry about them. I’m using Windows 10 and I think many things have been fixed or improved. I’m not motivated to discover which of those might be true.

PowerShell

I tend to work inside PowerShell which I find that it a bit nicer than Command Prompt. However, it’s a bit lacking in some UTF-8 aspects I haven’t been able to figure out. It doesn’t properly interpret the text that comes out of perl (or at least I and Google couldn’t figure it out). I’ll do basic Windows maintenance there such as installing software and so on. I start it as an administrator to do my work and then get out. For basic development I use ConEmu.

The Chocolatey package manager

I use the Chocolatey package manager to get most of what I need. That includes Strawberry Perl and ConEmu. Follow its installation instructions to install that from a PowerShell administrator window:

After that you can drop the administrator PowerShell window and open a regular user window. You can do all of this in an administrator window in one of the other console programs I think, but chocolatey is a PowerShell thing so that’s where I start.

I set up two fonts in ConEmu and that seems to work out well for me. For reasons I didn’t investigate and may have accidentally solved things, setting the fallback font to Symbola solved many problems with missing characters.

If you also installed ActivePerl look closely to see that you are getting the one that you expect.

Edit a file

Somehow create and edit a file. If you installed NotePad++ you can run it from the command line:

C:\Users\amelia> notepad++ hello.p1

Put in this simple text:

#!perl
print "Hello Perl!\n";

Run a file

C:\Users\amelia> perl hello.pl
Hello Perl!

When that works, try something more complicated that has a bunch of Unicodey things in it:

#!perl
use utf8;
use open qw(:std :utf8);
print <

Run that to see if you get what you expect in the console.

If it looks garbled into the console, redirect the output to a file and look there. The program is probably outputting the right thing but the console is not interpreting correctly. Your editor probably displays the file correctly.

You might also check that you aren't accidentally getting an UTF-8 BOM (byte order mark). For some reason some Windows things like to put that at the beginning of your file. Notepad++ has an option to do this although mine was turned off when I installed it.