perl-unicode

[5.8.0] problem with $ in $utf_text =~ s/xxx$//s;

2003-10-03 18:30:06
peace of code:
[snip]
        require Encode;
print Encode::is_utf8($tmp)? "Unicode string.\n":"None Unicode tring.\n";
        binmode STDOUT, ":utf8";
        print "Text: '$tmp', tag name: '$name'\n";
        print "Cool\n" if ($tmp =~ /<\/$name>/s);
        print "Very Cool\n" if ($tmp =~ /<\/$name>$/s);
        print "'" . ord(substr($tmp,-1))."'\n";
        print "'" . substr($tmp,-1)."'\n";
        unless ($tmp =~ s/<\/$name>$//s) {
                die "No close for '$name' tag in '$tmp';\n";
        }
[snip]

output:

Unicode string.
Wide character in print at Parser/Element.pm line 127.
Text: '
        <part name="Content">
                <p><b>???????????</b></p>
<p style="padding-left: 10px; margin-top: 2px;">???????????????????????????????</p>
        </part>
</dtpl>', tag name: 'dtpl'
Cool
'62'
'>'
No close for ...
_______________________________________________________________________________________

workaround that helps:
        Encode::_utf8_off($tmp);
        unless ($tmp =~ s/<\/$name>$//s) {
                die "No close for '$name' tag in '$tmp';\n";
        }
        Encode::_utf8_on($tmp);

<Prev in Thread] Current Thread [Next in Thread>