ghuntley / Heijden.Dns

A reusable DNS resolver for .NET.
https://ghuntley.com/
MIT License
30 stars 26 forks source link

UTF-8 support #2

Open Lakritzator opened 8 years ago

Lakritzator commented 8 years ago

If I understood the specifications correctly, DNS support UTF-8 (at least partly) for some time now. A change to your library which actually should not break anything (ASCII and UTF-8 are quite compatible) would be if you build strings from byte-arrays with Encoding.UTF-8.GetString(byte-array) instead of adding them to a StringBuilder byte by byte.

I found a fork of your project here, where the person changed the project to support the .NET Core: https://github.com/alanta/Heijden.Dns This might be interesting.

But what I found more interesting in his changes is this commit: https://github.com/alanta/Heijden.Dns/commit/98785aa8f024ecbf9497ce0d8940ad7c58253414 In ReadString he builds the string with Encoding.ASCII.GetString, when that would use Encoding.UTF8.GetString instead one part is already complete.. similar it should work for ReadDomainName.

ghuntley commented 8 years ago

Hey @Lakritzator I'm not currently using this library (anymore) at any of my clients, more than willing to add yourself or anyone else as a contributor, so that this library can keep growing.

Lakritzator commented 8 years ago

I was using this here: https://github.com/onovotny/Zeroconf Which also builds on the code of Heijden, which was embedded, so I looked at a nuget package with the same content. This is how I got here...

I didn't use your library directly, so I'm not really an expert nor had the need to resolve DNS records myself.

Anyway, I will have a look at it, maybe I do have an interest.. and report back. But Greenshot already occupies most of my time, the rest is taken by another new project "dapplo" which is currently work in progress...

P.S. Did you ever contact Alphons van der Heijden himself? Maybe he has an interest himself, his code seems to be used a lot. :)