Thread gethostbyname und umlautdomains: to puny or not to puny? (15 answers)
Opened by esskar at 2006-09-28 19:26

renee
 2006-10-03 23:12
#70390 #70390
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
So klappt's bei mir:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl

use strict;
use warnings;
use Encode::Punycode;
use Encode;
use Socket;

print getip( 'müller.de' );

sub getip {
my ($host) = @_;

my ($name,$tld) = split(/\./,$host);

my $encoded = encode('Punycode',$name);
print $encoded,"\n";

my $addr = gethostbyname( $encoded.'.'.$tld );
$addr = gethostbyname( $host ) unless $addr;

die "Hostname $host doesn't exist.\n" unless $addr;

return inet_ntoa( $addr );
}


Ausgabe:
Code: (dl )
1
2
3
C:\community>perl punycode.pl
xn--mller-kva
194.6.208.111


Perl 5.8.8
Win XP Home

CPAN:Encode::Punycode 0.02
CPAN:IDNA::Punycode 0.03
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread gethostbyname und umlautdomains: to puny or not to puny?