in reply to Chinese site and decoded_content() trouble
(update: actually, I tried it with both "decode_content" and "decoded_content" -- both yielded the same sort of error)Can't locate object method "decoded_content" via package "HTTP::Header +s"
But when I ran it with Data::Dumper and dumped the contents of $response, I could see that it had plenty of utf8 data with lots of Chinese characters.
I even upgraded LWP::UserAgent from 2.024 to 2.033 (the current version as of this writing), but got the same error. Did you happen to get that error as well? (It would have been worthwhile to say so.)
If I just use the method "content" (instead of "decoded_content"), I see a lot of page content. Did you try that? Is there some reason why the output of "content" isn't what you really want?
Another update: I forgot to comment on this:
Using content() works but gives (at least in console) garbled data. Doing decode("utf8", $response->content) looks like doubly decoding.
Are you sure you are using a utf8-capable console, with an appropriate unicode font that includes Chinese characters? You might try this little unicode transliterator script -- run the original data through that (without decode('utf8',...)) to see if it really is garbled. (Doesn't look garbled at all in my macosx "Terminal" window -- but I know better than to try pushing through a traditional xterm.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Chinese site and decoded_content() trouble
by varian (Chaplain) on Jun 09, 2007 at 08:57 UTC | |
|
Re^2: Chinese site and decoded_content() trouble
by isync (Hermit) on Jun 11, 2007 at 08:54 UTC |