Skip to content

Commit

Permalink
idna: update from x/text
Browse files Browse the repository at this point in the history
CL 359634: use nontransitional processing in Go 1.18
CL 317731: fix int32 overflows

Updates golang/go#46001
Updates golang/go#47510
Updates golang/go#28233

Change-Id: I2d9cdf5caa44f7c9b2834a256e7464b6edaae9ef
Reviewed-on: https://go-review.googlesource.com/c/net/+/360381
Trust: Damien Neil <[email protected]>
Run-TryBot: Damien Neil <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
neild committed Nov 4, 2021
1 parent 7594919 commit ce13745
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 32 deletions.
29 changes: 13 additions & 16 deletions idna/example_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.

// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
Expand All @@ -15,27 +13,26 @@ import (
func ExampleProfile() {
// Raw Punycode has no restrictions and does no mappings.
fmt.Println(idna.ToASCII(""))
fmt.Println(idna.ToASCII("*.faß.com"))
fmt.Println(idna.Punycode.ToASCII("*.faß.com"))
fmt.Println(idna.ToASCII("*.GÖPHER.com"))
fmt.Println(idna.Punycode.ToASCII("*.GÖPHER.com"))

// Rewrite IDN for lookup. This (currently) uses transitional mappings to
// find a balance between IDNA2003 and IDNA2008 compatibility.
// Rewrite IDN for lookup.
fmt.Println(idna.Lookup.ToASCII(""))
fmt.Println(idna.Lookup.ToASCII("www.faß.com"))
fmt.Println(idna.Lookup.ToASCII("www.GÖPHER.com"))

// Convert an IDN to ASCII for registration purposes. This changes the
// encoding, but reports an error if the input was illformed.
fmt.Println(idna.Registration.ToASCII(""))
fmt.Println(idna.Registration.ToASCII("www.faß.com"))
// Convert an IDN to ASCII for registration purposes.
// This reports an error if the input was illformed.
fmt.Println(idna.Registration.ToASCII("www.GÖPHER.com"))
fmt.Println(idna.Registration.ToASCII("www.göpher.com"))

// Output:
// <nil>
// *.xn--fa-hia.com <nil>
// *.xn--fa-hia.com <nil>
// *.xn--GPHER-1oa.com <nil>
// *.xn--GPHER-1oa.com <nil>
// <nil>
// www.fass.com <nil>
// idna: invalid label ""
// www.xn--fa-hia.com <nil>
// www.xn--gpher-jua.com <nil>
// www.xn--GPHER-1oa.com idna: disallowed rune U+0047
// www.xn--gpher-jua.com <nil>
}

func ExampleNew() {
Expand Down
14 changes: 14 additions & 0 deletions idna/go118.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions idna/idna10.0.0.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions idna/idna9.0.0.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions idna/pre_go118.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 25 additions & 11 deletions idna/punycode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ce13745

Please sign in to comment.