Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Proper Unicode handling in Perl

by Aldebaran (Chaplain)
on Sep 10, 2019 at 06:30 UTC ( #11105928=note: print w/replies, xml ) Need Help??


in reply to Re^3: Proper Unicode handling in Perl
in thread Is there some universal Unicode+UTF8 switch?

Codepages seem to be the sticky wicket:

C:\Users\tblaz\Documents\evelyn>perl 1.hello.cyr.pl
default encoding:
Active code page: 437
╨╤╨╕╨▓╨╡╤
------------
Active code page: 65001
Привет


#!/usr/bin/perl -w use 5.016; use utf8::all; #binmode STDOUT, ":utf8"; say "default encoding:"; system "chcp"; say "Привет"; say "------------"; system "chcp 65001"; say "Привет"; __END__

Once the right codepage is present, the test succeeeds:

C:\Users\tblaz\Documents\evelyn>perl 1.cyr.pl
...
-------
Content-Type: text/html; charset=utf-8

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Мой тест</title>
</head>
<body>
Бабкинъ Михаилъ
</body>
</html>
C:\Users\tblaz\Documents\evelyn>

Now I wonder how to make that the default setting....

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2019-12-09 18:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?