Nice progress! You don't even need the Encode module :)
This is a pretty straightforward way to deal with Unicode and UTF-8.
The remaining mentions of UTF-8 in your code have all their justification:
There are two caveats:
sub display_html {
use HTML::Entities;
my $html_encoded = encode_entities(shift, '<>&"');
my @html = (
'<!DOCTYPE html>',
'<html>',
'<head>',
'<meta charset="UTF-8">',
'<title>Мой тест</title>',
'</head>',
'<body>',
$html_encoded // 'Статус — ОК', # soft OR: 0 and empty string accepted
'</body>',
'</html>'
);
# to avoid "wide character" warnings:
binmode STDOUT, ':utf8';
print "Content-Type: text/html; charset=utf-8\n\n";
print join("\n", @html);
}
In reply to Re: Proper Unicode handling in Perl
by haj
in thread Is there some universal Unicode+UTF8 switch?
by VK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |