Added examples for Punycode lib. Makes godoc look pretty.
This commit is contained in:
parent
7f7df57ce4
commit
d353d0190a
|
@ -0,0 +1,18 @@
|
|||
package idn_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/miekg/dns/idn"
|
||||
)
|
||||
|
||||
func ExampleToPunycode() {
|
||||
name := "インターネット.テスト"
|
||||
fmt.Printf("%s -> %s", name, idn.ToPunycode(name))
|
||||
// Output: インターネット.テスト -> xn--eckucmux0ukc.xn--zckzah
|
||||
}
|
||||
|
||||
func ExampleFromPunycode() {
|
||||
name := "xn--mgbaja8a1hpac.xn--mgbachtv"
|
||||
fmt.Printf("%s -> %s", name, idn.FromPunycode(name))
|
||||
// Output: xn--mgbaja8a1hpac.xn--mgbachtv -> الانترنت.اختبار
|
||||
}
|
Loading…
Reference in New Issue