On Thu, Aug 16, 2012 at 8:18 AM, Pawel Krol <djgr...@gmail.com> wrote:

> Hello!
>
> I would like to ask you for a little assistance with the following issue...
>
> There are websites, which contain special German characters in their
> URLs, for example: 
> http://www.pbb-planungsbüro-bartsch.de<http://www.xn--pbb-planungsbro-bartsch-opc.de>(known
>  as
> "umlauts").
>
> I have been unsuccessfully trying to retrieve contents of such
> websites using Perl (basically the purpose of it is to check, whether
> the URL is valid/invalid - maybe there's a simpler way to do it?).
>
> Here's a code snippet, which you can try out immediately:
>
> #!/opt/local/bin/perl
>
> use Data::Dumper;
> use LWP::UserAgent;
>

use utf8;  # you have utf8 in your Perl source.


>
> my $url = 
> q{http://www.pbb-planungsbüro-bartsch.de<http://www.xn--pbb-planungsbro-bartsch-opc.de>
> };
> # my $url = q{http://www.pbb-planungsb%C3%BCro-bartsch.de/};
>
> my $ua = LWP::UserAgent->new;
> my $response = $ua->get($url);
>
> warn Dumper $response;
>
> __END__
>
> Well, it doesn't work. It gives me "500 Bad hostname" response
> regardless the URL being escaped or not.
>
> Question is... Is it possible to retrieve it at all? Are there any
> limitations? Workarounds?
>
> If you may kindly help me with resolving this problem, it would be
> very much appreciated.
>
> Many thanks for your help!
>
> Kind regards,
> Paweł Król.
>



-- 
Bill Moseley
mose...@hank.org

Reply via email to