encode_utf8(@$row[7])
@$row[7] is not a string, it's an array containing the eighth element of @$row.
Make sure what you are passing to encode_utf8 is a string by having
your program print out the value.
-pc
>The warning is still there.
>
>The code is below:
>
> my $page = get($URL);
>
> $te = HTML::TableExtract->new();
> $te->parse($page); # parse() returns an arrayref containing each table
> encountered
>
> $cont_table = 0;
> foreach $ts ($te->tables) { ## foreach $ts ($te->tables)
> if ($cont_table == 1) { ## Reporter's name is stored in Table 1
> Row 0
> $cont_row = 0;
> foreach $row ($ts->rows) {
> if ($cont_row == 0) {
> if(!defined @$row[7]) {
> $reporter = '';}
> else {
> $reporter = encode_utf8(@$row[7]);}
> last;
> }
> $cont_row++;
> }
>
> }
>.........
> }
>
>The error is at this line: $te->parse($page); but as it is an array.. I
>applied the encode_utf8 at its strings.
>I have applied decode too (according to "To convert an input string of bytes
>which represents a UTF-8 string, into Perl's internal string format, we DECODE
>the byes to from UTF-8") but the error persists.
>
>Any help is welcome!
>Thanks in advance.
>
>Bianca
>
>
>----- Mensagem original ----
>De: Bianca Shibuya <[EMAIL PROTECTED]>
>Para: [EMAIL PROTECTED]; [email protected]
>Enviadas: Sábado, 27 de Setembro de 2008 20:08:22
>Assunto: Res: Parsing of undecoded UTF-8 will give garbage when decoding
>entities
>
>Ow.. that is right. Thank you! I will try it.
>
>
>
>
>----- Mensagem original ----
>De: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
>Para: Bianca Shibuya <[EMAIL PROTECTED]>; [email protected]
>Cc: [EMAIL PROTECTED]
>Enviadas: Sábado, 27 de Setembro de 2008 19:58:27
>Assunto: Re: Parsing of undecoded UTF-8 will give garbage when decoding
>entities
>
>You have to pass strings to encode_utf8, so call it after converting the
>tables to strings, whenever that occurs. What you tried,
>encode_utf8($te->parse($page)), is passing encode_utf8 an arrayref, which
>cannot work. The other things you tried are incorrect.
>-pc
>
>>Hi people!
>>It is me again. =(
>>
>>I am having this warning: Parsing of undecoded UTF-8 will give garbage when
>>decoding entities.
>>
>>I have read that the solution is: The solution is to use the
>>Encode::encode_utf8() on the data before feeding it to the $p->parse().
>>
>>Ok then use the function encode_utf8(). But how?
>>
>>I have this piece of code:
>>
>> my $page = get($URL);
>>
>> $te = HTML::TableExtract->new();
>> $te->parse($page); # parse() returns an arrayref containing each
>> table encountered
>>
>> $cont_table = 0;
>> foreach $ts ($te->tables) {
>> (...)
>>
>> I tried to use: encode_utf8($te->parse($page));
>>
>> or: $te = encode_utf8(parse($page));
>> or: $te-> encode_utf8(parse($page));
>> or $var->encode_utf8(parse($page)); and where there is $te->tables, place
>> it by $var->tables
>>
>>You can see I dont know how to use it X-|
>>
>>Help me! Thank you.
>>
>>Bianca
>>
>>
>> Novos endereços, o Yahoo! que você conhece. Crie um email novo com a
>> sua cara @ymail.com ou @rocketmail.com.
>>http://br.new.mail.yahoo.com/addresses
>>
>
>
> Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua
> cara @ymail.com ou @rocketmail.com.
>http://br.new.mail.yahoo.com/addresses
>
>
>
> Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua
> cara @ymail.com ou @rocketmail.com.
>http://br.new.mail.yahoo.com/addresses
>