Li sim :)<br><br>&quot;The following functions are defined in the utf8:: package by the Perl core. You do not need to say use utf8 to use these and in fact you should not say that unless you really want to have UTF-8 source code.&quot;<br>

<br>Anyway, tentei fazer isso:<br>perl -pe &#39;utf8::encode($_);$_=uc&#39; teste.txt<br><br>Conforme o esperado, imprime na tela os caracteres corretos. Porém sem converter acentos para maiúsculas. Vai entender :(<br><br>

ABS()<br><br>
<br><br><div class="gmail_quote">2010/10/18 Daniel de Oliveira Mantovani <span dir="ltr">&lt;<a href="mailto:mantovani@perl.org.br">mantovani@perl.org.br</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Você leu o manual todo ?<br>
<br>
&quot;Converts in-place the internal octet sequence in the native encoding<br>
(Latin-1 or EBCDIC) to the equivalent character sequence in UTF-X.<br>
$string already encoded as characters does no harm.Returns the number<br>
of octets necessary to represent the string as UTF-X.Can be used to<br>
make sure that the UTF-8 flag is on, so that &quot;\w&quot; or &quot;lc()&quot; work as<br>
Unicode on strings containing characters in the range 0x80-0xFF (on<br>
ASCII<br>
and derivatives).&quot;<br>
<div><div></div><div class="h5"><br>
<br>
2010/10/18 Stanislaw Pusep &lt;<a href="mailto:creaktive@gmail.com">creaktive@gmail.com</a>&gt;:<br>
&gt; Infelizmente...<br>
&gt;<br>
&gt; <a href="http://perldoc.perl.org/utf8.html" target="_blank">http://perldoc.perl.org/utf8.html</a><br>
&gt; Do not use this pragma for anything else than telling Perl that your script<br>
&gt; is written in UTF-8.<br>
&gt;<br>
&gt; A minha referência atual sobre Perl e UTF-8 é esta (original em russo, não a<br>
&gt; tradução):<br>
&gt; <a href="http://translate.google.com/translate?hl=en-US&amp;sl=ru&amp;tl=en&amp;u=http%3A%2F%2Fxpoint.ru%2Fknow-how%2FPerl%2FPodderzhkaUnicode" target="_blank">http://translate.google.com/translate?hl=en-US&amp;sl=ru&amp;tl=en&amp;u=http%3A%2F%2Fxpoint.ru%2Fknow-how%2FPerl%2FPodderzhkaUnicode</a><br>


&gt;<br>
&gt; ABS()<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; 2010/10/18 Daniel de Oliveira Mantovani &lt;<a href="mailto:mantovani@perl.org.br">mantovani@perl.org.br</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; 2010/10/18 Daniel de Oliveira Mantovani &lt;<a href="mailto:mantovani@perl.org.br">mantovani@perl.org.br</a>&gt;:<br>
&gt;&gt; &lt;code&gt;<br>
&gt;&gt;  my $text;{$/=$\;$text=&lt;&gt;};<br>
&gt;&gt;  sub do_what_I_want {return uc(@_)};<br>
&gt;&gt;  when (detect_utf8($buf)) {<br>
&gt;&gt;     {<br>
&gt;&gt;        require utf8;<br>
&gt;&gt;        do_what_I_want(...)<br>
&gt;&gt;     }<br>
&gt;&gt;  }<br>
&gt;&gt;<br>
&gt;&gt;  { do_what_I_want(...) }<br>
&gt;&gt; &lt;/code&gt;<br>
&gt;&gt;<br>
&gt;&gt; Agora sim.<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; /me ;)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Procura no StackOverflow por Perl e codificação, o briand d foy deu<br>
&gt;&gt; &gt; uma explicação bem útil.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2010/10/18 Stanislaw Pusep &lt;<a href="mailto:creaktive@gmail.com">creaktive@gmail.com</a>&gt;:<br>
&gt;&gt; &gt;&gt; Tenho certeza de que o assunto foi levantado várias vezes na lista,<br>
&gt;&gt; &gt;&gt; então,<br>
&gt;&gt; &gt;&gt; ATENÇÃO: o Perl tem excelentes mecanismos para tratar I/O em diversas<br>
&gt;&gt; &gt;&gt; codificações da maneira mais prática possível. Por exemplo, dá para<br>
&gt;&gt; &gt;&gt; pegar<br>
&gt;&gt; &gt;&gt; arquivo em ISO-8859-1 do STDIN e jogar para STDOUT em UTF-8, isso é<br>
&gt;&gt; &gt;&gt; canja de<br>
&gt;&gt; &gt;&gt; galinha. Sempre que abre um handle, é só especificar o que tem dentro<br>
&gt;&gt; &gt;&gt; que...<br>
&gt;&gt; &gt;&gt; Aí que está o MEU problema: nunca sei de antemão o que tem dentro :P<br>
&gt;&gt; &gt;&gt; A solução mais viável que encontrei até agora foi:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;         my $buf;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;         eval {<br>
&gt;&gt; &gt;&gt;                 open(TXT, &#39;&lt;&#39;, $file) or die &quot;impossivel abrir $file:<br>
&gt;&gt; &gt;&gt; $!&quot;;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;                 binmode TXT, &#39;:bytes&#39;;<br>
&gt;&gt; &gt;&gt;                 local $/ = undef;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;                 $buf = &lt;TXT&gt;;<br>
&gt;&gt; &gt;&gt;                 close TXT;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;         };<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;         my $iconv = new Text::Iconv(detect_utf8($buf) ? &#39;utf-8&#39; :<br>
&gt;&gt; &gt;&gt; &#39;iso-8859-1&#39;, &#39;utf-8&#39;);<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;         $buf = $iconv-&gt;convert($buf);<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;         Encode::_utf8_on($buf);<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Explicando: abro o arquivo do jeito &quot;cru&quot;, sem nenhuma codificação.<br>
&gt;&gt; &gt;&gt; Carrego<br>
&gt;&gt; &gt;&gt; o conteúdo no buffer. Aí uso Text::Iconv para converter a codificação.<br>
&gt;&gt; &gt;&gt; Detalhe importantíssimo: mesmo que os dados já estejam em UTF-8, ainda<br>
&gt;&gt; &gt;&gt; assim<br>
&gt;&gt; &gt;&gt; precisa aplicar o Text::Iconv. E ainda não acabou: Perl não reconhece o<br>
&gt;&gt; &gt;&gt; buffer como algo que tenha codificação UTF-8 até que eu force o flag<br>
&gt;&gt; &gt;&gt; UTF-8.<br>
&gt;&gt; &gt;&gt; Pronto! Depois disso tudo, $buf é um autêntico UTF-8. Posso dar uc()<br>
&gt;&gt; &gt;&gt; que &quot;ã&quot;<br>
&gt;&gt; &gt;&gt; vira &quot;Ã&quot;, e /\w/ pega os acentos também.<br>
&gt;&gt; &gt;&gt; Aqui está o código completo: <a href="http://tinypaste.com/c3680" target="_blank">http://tinypaste.com/c3680</a><br>
&gt;&gt; &gt;&gt; A pergunta é: existe alguma maneira menos ineficiente de se fazer isto?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; ABS()<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; SaoPaulo-pm mailing list<br>
&gt;&gt; &gt;&gt; <a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
&gt;&gt; &gt;&gt; <a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; &quot;If you’ve never written anything thoughtful, then you’ve never had<br>
&gt;&gt; &gt; any difficult, important, or interesting thoughts. That’s the secret:<br>
&gt;&gt; &gt; people who don’t write, are people who don’t think.&quot;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; &quot;If you’ve never written anything thoughtful, then you’ve never had<br>
&gt;&gt; any difficult, important, or interesting thoughts. That’s the secret:<br>
&gt;&gt; people who don’t write, are people who don’t think.&quot;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; SaoPaulo-pm mailing list<br>
&gt;&gt; <a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
&gt;&gt; <a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; SaoPaulo-pm mailing list<br>
&gt; <a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
&gt; <a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a><br>
&gt;<br>
<br>
<br>
<br>
--<br>
&quot;If you’ve never written anything thoughtful, then you’ve never had<br>
any difficult, important, or interesting thoughts. That’s the secret:<br>
people who don’t write, are people who don’t think.&quot;<br>
_______________________________________________<br>
SaoPaulo-pm mailing list<br>
<a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a><br>
</div></div></blockquote></div><br>