in reply to wrong encoding using WWW::Mechanize

Sounds like you are receiving UTF-16 and treating each byte as a character. Try changing

print OUTFILE $mech->response->content();

to

print OUTFILE $mech->response->decoded_content();

If that doesn't work, you'll need to decode it yourself (probably with decode 'UTF-16', but decode 'UTF-16le' or decode 'UTF-16be' may be necessary).

If Spreadsheet::WriteExcel doesn't encode it for you, you'll need to encode the data you place in Excel. I don't know which encoding it expects.

Replies are listed 'Best First'.
Re^2: wrong encoding using WWW::Mechanize
by Lawliet (Curate) on Jan 24, 2009 at 19:27 UTC
    print OUTFILE $mech->response->content();

    to

    print OUTFILE $mech->response->content();

    (Aren't those two statements the same thing?)

    And you didn't even know bears could type.

      hehe oops! Fixed.