1
|
<?php
|
2
|
$encoded = $decoded = $add = '';
|
3
|
header('Content-Type: text/html; charset=utf-8');
|
4
|
require_once('idna_convert.class.php');
|
5
|
$IDN = new idna_convert();
|
6
|
if (isset($_REQUEST['encode'])) {
|
7
|
$decoded = isset($_REQUEST['decoded']) ? stripslashes($_REQUEST['decoded']) : '';
|
8
|
$encoded = $IDN->encode($decoded);
|
9
|
}
|
10
|
if (isset($_REQUEST['decode'])) {
|
11
|
$encoded = isset($_REQUEST['encoded']) ? stripslashes($_REQUEST['encoded']) : '';
|
12
|
$decoded = $IDN->decode($encoded);
|
13
|
}
|
14
|
$lang = 'en';
|
15
|
if (isset($_REQUEST['lang'])) {
|
16
|
if ('de' == $_REQUEST['lang'] || 'en' == $_REQUEST['lang']) $lang = $_REQUEST['lang'];
|
17
|
$add .= '<input type="hidden" name="lang" value="'.$_REQUEST['lang'].'" />'."\n";
|
18
|
}
|
19
|
?>
|
20
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
21
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
22
|
<head>
|
23
|
<title>phlyLabs Punycode Converter</title>
|
24
|
<meta name="author" content="phlyLabs" />
|
25
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
26
|
<style type="text/css">
|
27
|
/*<![CDATA[*/
|
28
|
body { color:black;background:white;font-size:10pt;font-family:Verdana,Helvetica,Sans-Serif; }
|
29
|
body, form { margin:0; }
|
30
|
form { display:inline; }
|
31
|
input { font-size:8pt;font-family:Verdana,Helvetica,Sans-Serif; }
|
32
|
#round { width:730px;padding:10px;background-color:rgb(230,230,240);border:1px solid black;text-align:center;vertical-align:middle;margin:auto;margin-top:50px; }
|
33
|
th { font-size:9pt;font-weight:bold; }
|
34
|
#copy { font-size:8pt;color:rgb(60,60,80); }
|
35
|
#subhead { font-size:8pt; }
|
36
|
#bla { font-size:8pt;text-align:left; }
|
37
|
h5 {margin:0;font-size:11pt;font-weight:bold;}
|
38
|
/*]]>*/
|
39
|
</style>
|
40
|
</head>
|
41
|
<body>
|
42
|
<div id="round">
|
43
|
<h5>phlyLabs' pure PHP IDNA Converter</h5><br />
|
44
|
<span id="subhead">
|
45
|
See <a href="http://faqs.org/rfcs/rfc3490.html" title="IDNA" target="_blank">RFC3490</a>,
|
46
|
<a href="http://faqs.org/rfcs/rfc3491.html" title="Nameprep, a Stringprep profile" target="_blank">RFC3491</a>,
|
47
|
<a href="http://faqs.org/rfcs/rfc3492.html" title="Punycode" target="_blank">RFC3492</a> and
|
48
|
<a href="http://faqs.org/rfcs/rfc3454.html" title="Stringprep" target="_blank">RFC3454</a><br />
|
49
|
</span>
|
50
|
<br />
|
51
|
<div id="bla"><?php if ($lang == 'de') { ?>
|
52
|
Dieser Konverter erlaubt die ?bersetzung von Domainnamen zwischen der Punycode- und der
|
53
|
Unicode-Schreibweise.<br />
|
54
|
Geben Sie einfach den Domainnamen im entsprechend bezeichneten Feld ein und klicken Sie dann auf den darunter
|
55
|
liegenden Button. Sie k?nnen einfache Domainnamen, komplette URLs (wie http://j?rgen-m?ller.de)
|
56
|
oder Emailadressen eingeben.<br />
|
57
|
<br />
|
58
|
Stellen Sie aber sicher, dass Ihr Browser den Zeichensatz <strong>UTF-8</strong> unterst?tzt.<br />
|
59
|
<br />
|
60
|
Wenn Sie Interesse an der zugrundeliegenden PHP-Klasse haben, k?nnen Sie diese
|
61
|
<a href="http://phlymail.com/de/downloads/idna/download/">hier herunterladen</a>.<br />
|
62
|
<br />
|
63
|
Diese Klasse wird ohne Garantie ihrer Funktionst?chtigkeit bereit gestellt. Nutzung auf eigene Gefahr.<br />
|
64
|
Um sicher zu stellen, dass eine Zeichenkette korrekt umgewandelt wurde, sollten Sie diese immer zur?ckwandeln
|
65
|
und das Ergebnis mit Ihrer urspr?nglichen Eingabe vergleichen.<br />
|
66
|
<br />
|
67
|
Fehler und Probleme k?nnen Sie gern an <a href="mailto:team@phlymail.de">team@phlymail.de</a> senden.<br />
|
68
|
<?php } else { ?>
|
69
|
This converter allows you to transfer domain names between the encoded (Punycode) notation
|
70
|
and the decoded (UTF-8) notation.<br />
|
71
|
Just enter the domain name in the respective field and click on the button right below it to have
|
72
|
it converted. Please note, that you might even enter complete domain names (like jürgen-müller.de)
|
73
|
or a email addresses.<br />
|
74
|
<br />
|
75
|
Make sure, that your browser is capable of the <strong>UTF-8</strong> character encoding.<br />
|
76
|
<br />
|
77
|
For those of you interested in the PHP source of the underlying class, you might
|
78
|
<a href="http://phlymail.com/en/downloads/idna/download/">download it here</a>.<br />
|
79
|
<br />
|
80
|
Please be aware, that this class is provided as is and without any liability. Use at your own risk.<br />
|
81
|
To ensure, that a certain string has been converted correctly, you should convert it both ways and compare the
|
82
|
results.<br />
|
83
|
<br />
|
84
|
Please feel free to report bugs and problems to: <a href="mailto:team@phlymail.com">team@phlymail.com</a>.<br />
|
85
|
<?php } ?>
|
86
|
<br />
|
87
|
</div>
|
88
|
<table border="0" cellpadding="2" cellspacing="2" align="center">
|
89
|
<thead>
|
90
|
<tr>
|
91
|
<th align="left">Original (Unicode)</th>
|
92
|
<th align="right">Punycode (ACE)</th>
|
93
|
</tr>
|
94
|
</thead>
|
95
|
<tbody>
|
96
|
<tr>
|
97
|
<td align="right">
|
98
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
|
99
|
<input type="text" name="decoded" value="<?php echo htmlentities($decoded, null, 'UTF-8'); ?>" size="48" maxlength="255" /><br />
|
100
|
<input type="submit" name="encode" value="Encode >>" /><?php echo $add; ?>
|
101
|
</form>
|
102
|
</td>
|
103
|
<td align="left">
|
104
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
|
105
|
<input type="text" name="encoded" value="<?php echo htmlentities($encoded, null, 'UTF-8'); ?>" size="48" maxlength="255" /><br />
|
106
|
<input type="submit" name="decode" value="<< Decode" /><?php echo $add; ?>
|
107
|
</form>
|
108
|
</td>
|
109
|
</tr>
|
110
|
</tbody>
|
111
|
</table>
|
112
|
<br />
|
113
|
<span id="copy">Version used: 0.6.9; © 2004-2010 phlyLabs Berlin; part of <a href="http://phlymail.com/">phlyMail</a></span>
|
114
|
</div>
|
115
|
</body>
|
116
|
</html>
|