[SP-pm] Malformed UTF-8

breno breno at rio.pm.org
Mon Sep 20 20:00:37 PDT 2010


2010/9/20 Marcio Ferreira <marciodesouzaferreira em gmail.com>:
> só amanhã do trabalho, mas basicamente eu uso o XML::Bare para carregar o
> XML, faço um trim nos abributos do XML, já que o XML::Bare não o faz.

> Eu gostaria de saber a causa do problema.
>

O comando "perldoc perldiag" disse o seguinte sobre a causa do seu problema:

-----------------8<-----------------
Malformed UTF-8 character (%s)
           (S utf8) (F) Perl detected a string that didn’t comply with UTF-8
           encoding rules, even though it had the UTF8 flag on.

           One possible cause is that you set the UTF8 flag yourself for data
           that you thought to be in UTF-8 but it wasn’t (it was for example
           legacy 8-bit data). To guard against this, you can use
           Encode::decode_utf8.

           If you use the ":encoding(UTF-8)" PerlIO layer for input, invalid
           byte sequences are handled gracefully, but if you use ":utf8", the
           flag is set without validating the data, possibly resulting in this
           error message.

           See also "Handling Malformed Data" in Encode.
----------------->8-----------------

Mais que isso, acho que só olhando o seu código :-)

[]s

-b


More information about the SaoPaulo-pm mailing list