Talk About Network

Google





Mac > Perl on OSX > Re: Res: Res: R...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1074 of 1079
Post > Topic >>

Re: Res: Res: Res: Parsing of undecoded UTF-8 will give garbage

by pchase@[EMAIL PROTECTED] Sep 27, 2008 at 02:31 PM

If you copy @[EMAIL PROTECTED]
 into a string variable you will see that its value i=
s 1. What you meant is $$row[7] or $row->[7].
Any variable starting with @[EMAIL PROTECTED]
 is an array, so you cannot pass it to encode=
_utf8.

>Thank you for your help.
>But the content of @[EMAIL PROTECTED]
 is a string (I have printed out it). If it i=
s not a string, I cannot identify other variable to apply this function. =
=3D( Because the rest of the program is a sequence of ifs similar to the =
last if.
>
>Thanks in advance.
>Bianca
>
>
>----- Mensagem original ----
>De: "pchase@[EMAIL PROTECTED]
" <pchase@[EMAIL PROTECTED]
>
>Para: Bianca ****buya <biahs99@[EMAIL PROTECTED]
>; macosx@[EMAIL PROTECTED]
>Cc: pchase@[EMAIL PROTECTED]
>Enviadas: S=E1bado, 27 de Setembro de 2008 21:54:30
>Assunto: Re: Res: Res: Parsing of undecoded UTF-8 will give garbage when=
     decoding     entities
>
>encode_utf8(@[EMAIL PROTECTED]
)
>
>@[EMAIL PROTECTED]
 is not a string, it's an array containing the eighth element of=
 @[EMAIL PROTECTED]
>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 =3D get($URL);
>>
>>   $te =3D HTML::TableExtract->new();
>>   $te->parse($page); # parse() returns an arrayref containing each tab=
le encountered
>>
>>   $cont_table =3D 0;
>>   foreach $ts ($te->tables) {      ## foreach $ts ($te->tables)
>>      if ($cont_table =3D=3D 1) {       ## Re****ter's name is stored in=
 Table 1 Row 0
>>          $cont_row =3D 0;
>>          foreach $row ($ts->rows) {
>>             if ($cont_row =3D=3D 0) {
>>                 if(!defined @[EMAIL PROTECTED]
) {
>>                    $re****ter =3D '';}
>>                 else {
>>                     $re****ter =3D encode_utf8(@[EMAIL PROTECTED]
);}
>>                 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 ****buya <biahs99@[EMAIL PROTECTED]
>
>>Para: pchase@[EMAIL PROTECTED]
 macosx@[EMAIL PROTECTED]
>>Enviadas: S=E1bado, 27 de Setembro de 2008 20:08:22
>>Assunto: Res: Parsing of undecoded UTF-8 will give garbage when decodin=
g     entities
>>
>>Ow.. that is right. Thank you! I will try it.
>>
>>
>>
>>
>>----- Mensagem original ----
>>De: "pchase@[EMAIL PROTECTED]
" <pchase@[EMAIL PROTECTED]
>
>>Para: Bianca ****buya <biahs99@[EMAIL PROTECTED]
>; macosx@[EMAIL PROTECTED]
>>Cc: pchase@[EMAIL PROTECTED]
>>Enviadas: S=E1bado, 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 th=
e 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. =3D(
>>>
>>>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::e=
ncode_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 =3D get($URL);
>>>
>>>   $te =3D HTML::TableExtract->new();
>>>   $te->parse($page);       # parse() returns an arrayref containing e=
ach table encountered
>>>
>>>   $cont_table =3D 0;
>>>   foreach $ts ($te->tables) {
>>>  (...)
>>>
>>>  I tried to use: encode_utf8($te->parse($page));
>>>
>>>  or: $te =3D 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=E7os, o Yahoo! que voc=EA conhece. Crie um email no=
vo com a sua cara @[EMAIL PROTECTED]
 ou @[EMAIL PROTECTED]
>>>http://br.new.mail.yahoo.com/addresses
>>>
>>
>>
>>      Novos endere=E7os, o Yahoo! que voc=EA conhece. Crie um email nov=
o com a sua cara @[EMAIL PROTECTED]
 ou @[EMAIL PROTECTED]
>>http://br.new.mail.yahoo.com/addresses
>>
>>
>>
>>      Novos endere=E7os, o Yahoo! que voc=EA conhece. Crie um email nov=
o com a sua cara @[EMAIL PROTECTED]
 ou @[EMAIL PROTECTED]
>>http://br.new.mail.yahoo.com/addresses
>>
>
>
>      Novos endere=E7os, o Yahoo! que voc=EA conhece. Crie um email novo=
 com a sua cara @[EMAIL PROTECTED]
 ou @[EMAIL PROTECTED]
>http://br.new.mail.yahoo.com/addresses
>
 




 1 Posts in Topic:
Re: Res: Res: Res: Parsing of undecoded UTF-8 will give garbage
pchase@[EMAIL PROTECTED]   2008-09-27 14:31:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 13:44:19 PST 2009.