Talk About Network

Google





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

Res: Res: Res: Res: Parsing of undecoded UTF-8 will give garbage when decoding entities

by biahs99@[EMAIL PROTECTED] (Bianca Shibuya) Sep 28, 2008 at 01:08 AM

Thank you all!=0A=0APart of my code is:=0A=0Asub get_opendate {=0A   my
$UR=
L =3D ****ft;=0A   my $page =3D get($URL);=0A=0A   $te =3D
HTML::TableExtrac=
t->new(); =0A   $te->parse($page); # parse() returns an arrayref
containing=
 each table encountered=0A   =0A   $cont_table =3D 0;=0A   foreach $ts
($te=
->tables) {   =0A      if ($cont_table =3D=3D 4) {       ## Submission
date=
 is stored in the table 4=0A          $cont_row =3D 0;=0A          foreach
=
$row ($ts->rows) {      =0A             if ($cont_row =3D=3D 0) {=0A      
=
       if(!defined @[EMAIL PROTECTED]
) {=0A                    $date =3D '';}=0A    
=
            else {=0A                    $date =3D decode_utf8($row->[1]);
=
}=0A                 last;=0A             }=0A             $cont_row++;=0A
=
         }=0A      }=0A      ## If the bug re****t has received votes (it
ch=
anges the HTML structure) than the submission date is stored in Table 5
Row=
 0=0A      if (($cont_table =3D=3D 5) && ($date eq '')) {     =0A         
=
$cont_row =3D 0;=0A          foreach $row ($ts->rows) {      =0A          
=
  if ($cont_row =3D=3D 0) {=0A                 $test =3D
decode_utf8($row->=
[1]);     #### As $date does not accept the value of @[EMAIL PROTECTED]
 directly, I
h=
ad to use a different variable=0A                 $date =3D $test;=0A     
=
           last;=0A             }=0A             $cont_row++;=0A         
}=
=0A      }  =0A      $cont_table++;=0A   } ## Closing the first foreach=0A
=
  =0A   print "$date\n";=0A   =0A   $year =3D substr($date, -4);=0A  
$mont=
h =3D substr($date, 12, 3);=0A   $day =3D substr($date, 16, 2);=0A=0A  
ret=
urn $year, $month, $day;=0A}=0A=0AHow can I change it to make the warning
d=
isappear?=0A=0AThank you all in advance.=0A=0ABianca=0A----- Mensagem
origi=
nal ----=0ADe: Chas. Owens <chas.owens@[EMAIL PROTECTED]
>=0APara: Bianca ****buya
<b=
iahs99@[EMAIL PROTECTED]
>=0ACc: "pchase@[EMAIL PROTECTED]
"
<pchase@[EMAIL PROTECTED]
>; "macosx@[EMAIL PROTECTED]
" <macosx@[EMAIL PROTECTED]
>=0AEnviadas: Domingo, 28 de
Set=
embro de 2008 2:19:14=0AAssunto: Re: Res: Res: Res: Parsing of undecoded
UT=
F-8 will give garbage when     decoding     entities=0A=0A=0AOn Sep 27,
200=
8, at 10:00, Bianca ****buya <biahs99@[EMAIL PROTECTED]
> wrote:=0A=0A> Thank you
=
for your help.=0A> But the content of @[EMAIL PROTECTED]
 is a string (I have printed
=
out it). If  =0A> it is not a string, I cannot identify other variable to
a=
pply this  =0A> function. =3D( Because the rest of the program is a
sequenc=
e of ifs  =0A> similar to the last if.=0A>=0A> Thanks in advance.=0A>
Bianc=
a=0A=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=
=0A>>=0A>>=0A>>>=0A>>>=0A>>>=0A>>>=0A>>>=0A>>>=0A>>>=0A>>>=0A>>>=0A>>>=0A>>=
>=0A>>>=0A>>>=0A>>>=0A>>>=0A>>=0A>>=0A>>=0A>>=0A>>=0A>>=0AIf you
said=0A=0A=
print @[EMAIL PROTECTED]
 that is equivalent to=0A=0Aprint join $,,
@[EMAIL PROTECTED]
 really see the value of that expression you need to
say=0A=0Apri=
nt map { "[$_] " } @[EMAIL PROTECTED]
 will print the individual items in
t=
he list surrounded by brackets.=0A=0A=0A      Novos endere=E7os, o Yahoo!
q=
ue voc=EA conhece. Crie um email novo com a sua cara @[EMAIL PROTECTED]
 ou
@[EMAIL PROTECTED]

 




 1 Posts in Topic:
Res: Res: Res: Res: Parsing of undecoded UTF-8 will give garbage
biahs99@[EMAIL PROTECTED]  2008-09-28 01:08:49 

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:40:06 PST 2009.