我有 comЯade这个词,但由于俄语 Я,我无法在 HTML 中打印它...我试过了:
$HTML::Entities::char2entity{'Я'} = 'Я';
$HTML::Entities::char2entity{'1071'} = 'Я';
$HTML::Entities::char2entity{'ï'} = 'Я';
$str = HTML::Entities::encode_entities( $str, q{Яï1071} );
之后我尝试了:
$str =~ s/1071/Я/g;
$str =~ s/Я/Я/g;
$str =~ s/ï/Я/g;
但在这两种情况下,我都会收到此错误:
/usr/local/share/perl/5.10.1/Starman/Server.pm 第 470 行的 syswrite 中的宽字符。
为什么?
一些代码:
标题.mi
<%init>
binmode STDOUT, ':encoding(UTF-8)';
($str =~ s/&/%26/g;); #this is working
$str =~ s/1071/Я/g;
$str =~ s/Я/Я/g;
$str =~ s/ï/Я/g;
</%init>
<div class="bd-headline left">
<h1 style="margin-top:0; padding-top:0;"> <% $str %> </h1>
</div>
基础.mc
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>