Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Perl, DOS and encodings

by haj (Vicar)
on Apr 29, 2020 at 22:10 UTC ( [id://11116248]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Perl, DOS and encodings
in thread Perl, DOS and encodings

The relevant information is the WindowsCodePage entry. This is the encoding which is used by cmd.exe to pass cyrillic characters from your terminal input to your Perl program, and you can not change it using chcp.

According to my experiments, which may be totally bogus, things get even more interesting if you write your command, including command line parameters with cyrillic characters, into a .bat file and execute that. In that case, the chcp setting will be used to decode the batch file - but still the Perl program will receive its @ARGV in the WindowsCodePage encoding.

So, if your batch file is UTF-8 encoded, you need to chcp 65001 and use --title-transcode=cp1251 if you pass the title as a command line parameter.

Replies are listed 'Best First'.
Re^4: Perl, DOS and encodings
by siberia-man (Friar) on Apr 30, 2020 at 07:24 UTC
    Oh, yes. I tested it, but my experiments were not completed. At least in pure DOS I have to specify cp1251 as encoding for parameters in the command line. It doesn't depend on the file encoding. If I run the same script under ConEmu, I have to specify the same encoding as the file itself.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found