You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
468 B
18 lines
468 B
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 -> الانترنت.اختبار |
|
}
|
|
|