Code for handling unicode/punycode name conversions

Addressing #120
Well. The reason I mention this is that copying net/http for the server has
been a huge success. I think the the standard lib has been well designed so
copying it is not a bad thing to do. OTOH the dns encoding is also an
encoding and it don't use ib there... Arhhh. The problems of designing an
api. Let's go with the current one, as it the simplest.
On 12 Sep 2014 13:02, "Alex Sergeyev" <notifications@github.com> wrote:

> In idn/punycode.go:
>
> > +	_BIAS rune = 72
> > +	_N    rune = 128
> > +
> > +	_DELIMITER = '-'
> > +	_PREFIX    = "xn--"
> > +)
> > +
> > +func ToPunycode(s string) string {
> > +	tokens := bytes.Split([]byte(s), []byte{'.'})
> > +	for i := range tokens {
> > +		tokens[i] = encodeBytes(tokens[i])
> > +	}
> > +	return string(bytes.Join(tokens, []byte{'.'}))
> > +}
> > +
> > +func FromPunycode(s string) string {
>
> Technically it's "bootstring encoding" with particular parameters. So we
> can do that but IMO it would push things a bit outside of DNS scope.
>
> type Encoder {
>     tmin, tmax, skew, damp, base, bias, n rune
>     prefix string
> }
> var Punycode = NewEncoder(....)
>
> import "dns/idn"
> idn.Punycode.Encode()
>
> and so on....
>
> I'm indifferent here, as long as functionality there it is usable for me
> but if you see compatibility gains by using encoding approach, I'd follow
> up on it.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/miekg/dns/pull/128/files#r17475064>.
>