On Sat, Dec 1, 2012 at 8:50 PM, boB Stepp <robertvst...@gmail.com> wrote:
> Hey Tim,
>
> On Sat, Dec 1, 2012 at 10:34 PM, timothy adigun <2teezp...@gmail.com> wrote:
>> Hi bOB,
>> Please check my comments below
>>
>
>> It is very possible, just in 3 steps.
>>
>>  Here is what you had always wanted to do:
>>   1. Open up your command Prompt, then
>>
>>   2. You will need to change your cmd font to "Lucida Console", because
>> other fonts don't contain all the codepoints.
>> So, to do this, Right-click on the bar of the cmd Prompt, click on
>> Properties, then on Fonts tab, select "Lucida Console",
>
> Based on my searching, I had already done steps 1) and 2). These
> change the default values of the command console.
>
>>
>> 3. Ordinarily, if you type "chcp" on the cmd Prompt, you will get this :
>> Active code page: 850
>> The current Active code. To display Unicode however, you will need to change
>> that to 65001.
>> So, you might change it by typing "chcp 65001" on your cmd Prompt or do it
>> in your Perl script, using a backtick.
>>
>>  Here is how your script now looks:
>>
>> use warnings;
>> use strict;
>> use utf8;
>>
>> `chcp 65001`;
>> binmode STDOUT, ":encoding(UTF-8)";
>> print "\x{03B1}\x{03C9}\n";
>
> If you recall my original posting, I essentially did what you just
> said in step 3) except that I used system() instead of the backticks


Yes, system()  would be preferable to backticks in void context.
To see why:

     perldoc -q "What's wrong with using backticks in a void context?"


.
> What I would like to do is make chcp 65001 the default behavior of the
> command console without having to either retype it manually or place
> it in each and every script for each time I open the command prompt.
> Secondarily, I would like to eliminate what appears to be Windows
> informational message of "Active code page: 65001".


     On the command line, I believe you just redirecto to nul:

              chch 2>nul

    From a  perl program:  use the File::Spec sequence I showed earlier


> But as I said,
> unless you or someone else knows something different to do, there is
> no way to permanently change the default behavior of the command
> prompt on my system. Is it clear what I am actually asking?
>
> One thing you add above, "use strict;": I have not reached this in my
> book yet. Is this something you would recommend me to add to my
> scripts routinely?
>

   Yes, 'use strict;' has been a best practice for some time.
   See:  perldoc perlstyle

-- 
Charles DeRykus

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to