Documentation ¶
Overview ¶
Package idn implements encoding from and to punycode as speficied by RFC 3492.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromPunycode ¶
FromPunycode returns unicode domain name from provided punycode string.
Example ¶
package main import ( "fmt" "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/miekg/dns/idn" ) func main() { name := "xn--mgbaja8a1hpac.xn--mgbachtv" fmt.Printf("%s -> %s", name, idn.FromPunycode(name)) }
Output: xn--mgbaja8a1hpac.xn--mgbachtv -> الانترنت.اختبار
func ToPunycode ¶
ToPunycode converts unicode domain names to DNS-appropriate punycode names. This function would return incorrect result for strings for non-canonical unicode strings.
Example ¶
package main import ( "fmt" "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/miekg/dns/idn" ) func main() { name := "インターネット.テスト" fmt.Printf("%s -> %s", name, idn.ToPunycode(name)) }
Output: インターネット.テスト -> xn--eckucmux0ukc.xn--zckzah
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.