Skip to content

Commit

Permalink
Added examples for Punycode lib. Makes godoc look pretty.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Sergeyev committed Sep 18, 2014
1 parent 7f7df57 commit d353d01
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions idn/example_test.go
@@ -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 -> الانترنت.اختبار
}

0 comments on commit d353d01

Please sign in to comment.