Yeah, that's bound to go wrong -- the code in question does:
elif isinstance(value, str):
suffix = value.encode('utf-8')
So value is a (byte) string and the code tries to *encode* it. That's
effectively the same as doing
unicode(value).encode('utf-8')
which in turn is the same as
value.decode('ASCII').encode('utf-8')
since the default codec is still ASCII. I think this looks like a
mistake in Zeroconf -- it could have made sense if it tried to *decode*
the string from a UTF-8 byte string to a Unicode object.
I don't really know anything about zeroconf, though. If it does not
support non-ASCII characters at all, then we can solve the problem on
our end by stripping them. If it does support, say, UTF-8 encoded
strings, then this looks like a bug in Zeroconf. |