note
Juerd
<p><blockquote><em>Let me repeat the question
</em></blockquote></p>
<p>
Do you expect me to repeat the answer too? :)
</p>
<p>
If your subroutine or module specifically only handles binary strings, I'd recommend documenting it as such, and downgrading the string that you receive:
<code>
my $copy = $foo;
utf8::downgrade($copy) or utf8::encode($copy) && carp "Wide character in operation";
</code>
That's more or less what Perl does in its binary operators, like [print].
</p>
<p>
Whatever you do, though, never assume that the absence of the flag means it's not a text string!
</p>
<div class="pmsig"><div class="pmsig-132236">
<p><font color="#800000">
Juerd
# { site => '<a href="http://juerd.nl/" target="_blank"><font color="#800000">juerd.nl</font></a>', do_not_use => '<a href="mailto:spamcollector_perlmonks@juerd.nl" target="_blank"><font color="#800000">spamtrap</font></a>', perl6_server => '<a href="http://feather.perl6.nl/"><font color="#800000">feather</font></a>' }</font></p>
</font></p>
</div></div>
670272
670585