Advertisements

On 25 Nov 2006 18:00:20 -0800, wrote:
> In the following problem, I use TK to get a page and show it, but
>
>I get nothing when I use it on a chinese web page, and it can get some
>thing for a english based web page, why?

There is something funny in the way you decide there are no results,
and when a error occurs. so it shows nothing.
I tried chopping down your script, so that it just displayed the page
without any word search or html parsing, so to work out 1 problem
at a time.
Your script did not display Chinese characters properly, on my
machine.

This is what I did.
In order to avoid the complexity of your html parsing, (which I think is
broken), I just display the url, so you can see it works.
> I think it may the the "FONT" problem, but I do not not how to
>special a chinese font.

I commented out all font lines and let Tk do it.
I hope it helps you out. I just used a simple parser
to extract text.

#!/usr/bin/perl
use warnings;
use strict;
use Tk;
require LWP::UserAgent;
use utf8;
use Encode;
use HTML::Encoding 'encoding_from_http_message';
use HTML::TokeParser;
use HTML::TokeParser::Simple;

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!