Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added examples for Punycode lib. Makes godoc look pretty.
- Loading branch information
Alex Sergeyev
committed
Sep 18, 2014
1 parent
7f7df57
commit d353d01
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 -> الانترنت.اختبار | ||
} |