Parsing of undecoded UTF-16 error

Discussion in 'Perl Misc' started by livefreeordie, Oct 15, 2007.

  1. Hi - I'm using the following construct to parse an HTML page:

    use HTTP::Request;
    use LWP::UserAgent;

    my $req = new HTTP::Request(GET=>$url);
    my $ua = new LWP::UserAgent();
    my $resp = $ua->request($req);
    my $content = $resp->decoded_content();

    I'm getting the following error when attempting to access this URL:

    Error: Parsing of undecoded UTF-16 at C:/Perl/lib/LWP/Protocol.pm line
    116.
    URL: http://securities.stanford.edu/1009/RICKEL96/'

    When I take a look at the content, each character is separated by a
    newline or space.

    What is this, and how can I get around it? I've retrieved other pages
    successfully.

    Jamie
    livefreeordie, Oct 15, 2007
    #1
    1. Advertising

  2. livefreeordie

    Mumia W. Guest

    On 10/15/2007 01:02 AM, livefreeordie wrote:
    > Hi - I'm using the following construct to parse an HTML page:
    >
    > use HTTP::Request;
    > use LWP::UserAgent;
    >
    > my $req = new HTTP::Request(GET=>$url);
    > my $ua = new LWP::UserAgent();
    > my $resp = $ua->request($req);
    > my $content = $resp->decoded_content();
    >
    > I'm getting the following error when attempting to access this URL:
    >
    > Error: Parsing of undecoded UTF-16 at C:/Perl/lib/LWP/Protocol.pm line
    > 116.
    > URL: http://securities.stanford.edu/1009/RICKEL96/'
    >


    I don't get this with LWP::UserAgent 2.033 and HTTP::Request 1.40.

    > When I take a look at the content, each character is separated by a
    > newline or space.
    >


    The characters are separated by nulls. The file is in UTF16LE format;
    however, this is not advertised in the HTTP header.


    > What is this, and how can I get around it? I've retrieved other pages
    > successfully.
    >
    > Jamie
    >


    What version of Perl are you using? What module versions are you using?
    Mumia W., Oct 15, 2007
    #2
    1. Advertising

  3. On Oct 15, 3:16 am, "Mumia W." <paduille.4061.mumia.w
    > wrote:
    > On 10/15/2007 01:02 AM, livefreeordie wrote:
    >
    >
    >
    >
    >
    > > Hi - I'm using the following construct to parse an HTML page:

    >
    > > use HTTP::Request;
    > > use LWP::UserAgent;

    >
    > > my $req = new HTTP::Request(GET=>$url);
    > > my $ua = new LWP::UserAgent();
    > > my $resp = $ua->request($req);
    > > my $content = $resp->decoded_content();

    >
    > > I'm getting the following error when attempting to access this URL:

    >
    > > Error: Parsing of undecoded UTF-16 at C:/Perl/lib/LWP/Protocol.pm line
    > > 116.
    > > URL: http://securities.stanford.edu/1009/RICKEL96/'

    >
    > I don't get this with LWP::UserAgent 2.033 and HTTP::Request 1.40.
    >
    > > When I take a look at the content, each character is separated by a
    > > newline or space.

    >
    > The characters are separated by nulls. The file is in UTF16LE format;
    > however, this is not advertised in the HTTP header.
    >
    > > What is this, and how can I get around it? I've retrieved other pages
    > > successfully.

    >
    > > Jamie

    >
    > What version of Perl are you using? What module versions are you using?- Hide quoted text -
    >
    > - Show quoted text -


    ActivePerl v5.8.8 built for MSWin32-x86-multi-thread
    LWP::UserAgent version is 2.036
    HTTP::Request version is 1.40

    Thanks,
    Jamie
    livefreeordie, Oct 17, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JJBW
    Replies:
    1
    Views:
    10,064
    Joerg Jooss
    Apr 24, 2004
  2. =?Utf-8?B?QXNoYQ==?=
    Replies:
    3
    Views:
    418
  3. Arifi Koseoglu
    Replies:
    2
    Views:
    953
    Arifi Koseoglu
    Apr 13, 2004
  4. Jimmy Shaw

    Converting from UTF-16 to UTF-32

    Jimmy Shaw, Jul 31, 2006, in forum: C++
    Replies:
    7
    Views:
    1,304
    P.J. Plauger
    Aug 1, 2006
  5. H.S.
    Replies:
    12
    Views:
    1,321
    Victor Bazarov
    Aug 10, 2007
Loading...

Share This Page