Last active
February 12, 2020 16:01
-
-
Save TheAthlete/7b84d0b8f34be4dc9a630fc3dbe43d5f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="windows-1251"> | |
<title>Тест</title> | |
</head> | |
<body> | |
<p>Привет</p> | |
<p><%= $str %></p> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/myperl5 | |
use strict; | |
use warnings; | |
use Mojo::Template; | |
use CGI; | |
use Encode qw/decode encode/; | |
my $mt = Mojo::Template->new(vars => 1)->encoding('cp1251'); | |
my $CGI = new CGI; | |
my $str = "вуифывафыва"; | |
$str = decode('cp1251', $str); | |
print $CGI->header(-type => "text/html; charset=cp1251"); | |
print encode('cp1251', $mt->render_file('foo.mt', {str => $str})); | |
print "абвгд" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment