New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/net/idna: add pre-defined profile for non-transitional IDNA2008 #47510
Comments
Updates: I added the Playground link and the pseudocode demonstrating the alternative approach. |
Is this different than the following? IDNA2000Lookup = idna.New(
idna.MapForLookup(),
idna.BidiRule(),
) |
Technically, it's the same. However, in terms of library user experience, it is quite different. I am confident in answering your question only because I have read through the entire file. I still remember that when I first checked the A ready-to-use profile for IDNA2008 would save my past self lots of time, and this proposal is from the perspective of a new user of this library. I feel pre-defined profiles for common cases would encourage correct usage of the library and have values on their own even if, after knowing all the bits of this library, they could be defined in terms of current options. This is what I meant by "unintuitive" in my proposal. I would never know some combination is correct until I read the source code. If I may, I really wanted to replace the |
Perhaps we should put @neild's example explicitly into the docs? |
Perhaps the docs should specify exactly how each profile is constructed.
Or we could change the var definition, at the expense of needing to initialize the profile at init time rather than statically:
|
This proposal has been added to the active column of the proposals project |
I have no strong opinion on whether we should add a predefined nontransitional lookup profile, but if we do I suggest |
Thank you, I think I can be satisfied with this (especially after https://go-review.googlesource.com/c/text/+/317729/ is merged) because it clearly shows how I can create non-transitional versions of existing profiles. I am also happy with any of suggested names for the new profile (if we decide to add a new one). |
It's unclear how #46001 will play out, but the fact that it's a question suggests that having the table available from an easy-to-call function (instead of having to copy an example) is probably worth doing. (A function with an internal sync.Once seems better than a global var, to avoid init-time overhead for unused things.) |
Looking at the definition of Profile, it has multiple methods we'd have to expose if we didn't expose the Profile itself. The docs for Lookup say it may change from time to time. Is it time to change it to non-transitional? We could still define idna.Transitional and idna.NonTransitional for people who want an explicit choice. It's also unclear whether Display, Registration, and Punycode need to change at the same time. /cc @mpvl |
If #46001 resolves in favor of using nontransitional processing in I do not believe Display, Registration, and Punycode need to change. Transitional processing only affects the lookup profile. (The docs for |
OK, sounds like this is blocked on #46001. |
#46001 is a likely accept, so I suppose this one is too (changing the default idna.Lookup). |
Based on the discussion above, this proposal seems like a likely accept. |
No change in consensus, so accepted. 🎉 |
Change https://golang.org/cl/359634 mentions this issue: |
Updates golang/go#46001 Updates golang/go#47510 Change-Id: I1e978a3c6230abfd0b1aaab0c7343b33dda1ba64 Reviewed-on: https://go-review.googlesource.com/c/text/+/359634 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Timothy Gu <timothygu99@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change https://golang.org/cl/360381 mentions this issue: |
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 <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
N.B., this has been fixed in 77c473f for Go 1.18, which changes the pre-defined Lookup profile to be non-transitional. |
Updates golang/go#46001 Updates golang/go#47510 Change-Id: I1e978a3c6230abfd0b1aaab0c7343b33dda1ba64 Reviewed-on: https://go-review.googlesource.com/c/text/+/359634 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Timothy Gu <timothygu99@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/zSGcE1no8yN
What did you expect to see?
I wish that
ß
was kept asß
as in Firefox and Safari.I am currently using the
idna
package to develop DNS-related tools (https://github.com/favonia/cloudflare-ddns), and I hope there is a predefined profile that uses non-transitional IDNA2008 processing. Despite the warnings that the actualLookup
profile could evolve over time, I understand that current software could rely on its specific behavior. Therefore, I propose adding a new profileIDNA2008Lookup
orNontransitionalLookup
(or some other good name---I am not a native English speaker anyways) as follows:Alternatively, the
idna
can provide new methods to create new profiles from the existing ones. It would then be trivial to create such a profile from existingLookup
profile (especially after the bugfix https://go-review.googlesource.com/c/text/+/317729/ is merged). Here is the pseudocode demonstrating the idea:What did you see instead?
ß
is mapped toss
, as in Chrome/Chromium.The
Lookup
profile currently implements what's called transitional processing in Unicode TS #46. It is the current behavior of Chrome/Chromium, though there is an open issue discussing a possible switch.Related Issues
This is closely related to #46001, which proposed to change the default behavior of
net/http
. I like #46001 very much, but chose to propose something more conservative in case there's any objection to #46001. This proposal merely adds a new helpful definition to facilitate non-transitional processing. Whether #46001 should be accepted or in general whether the standard library and other libraries should change their behaviors is out of the scope of this issue, though those changes would probably benefit from this proposal. I strongly believe the Go language should make it easy to write software using non-transitional IDNA2008 processing even if the standard library sticks to the current behavior.Further Justification
It is true that one can already define desirable profiles by carefully combining the correct set of options. I found the construction very unintuitive and strongly prefer a predefined profile ready to use.
Implementation Details and Auxiliary Changes
Introducing a new profile should be trivial. In fact, the above quoted code is almost all the necessary changes (modulo documentation and testing). Relatedly, the comment
It is used by most browsers when resolving domain names.
forTransitional
is no longer accurate and should also be changed, in my opinion.The text was updated successfully, but these errors were encountered: