[getdns-users] bindata string encoding?

Robert Edmonds edmonds at debian.org
Fri Jul 10 17:09:04 UTC 2015


Daniel Kahn Gillmor wrote:
> I think the right fix is for the python bindings to treat the string as
> a proper bindata, but i also think that the bindata string returned from
> the C library in getdns_get_api_info's version_string probably shouldn't
> have the embedded NUL in it.  Fixing the python bindings before fixing
> the C library is probably the safest way to go, though.

Maybe something like the attached?

Related: porting this code to Python 3 brings up a choice between
treating these fields as the Python 3 'str' type, or the Python 3
'bytes' type.  'str' is a little bit easier to work with if dealing with
textual data (IMO), but it requires selecting an explicit character
encoding.  If you're going to explicitly allow these fields to contain
C-style string termination, there's not much harm in also explicitly
defining that they must be encoded with a specific character encoding,
say UTF-8 or 7-bit US-ASCII.  That would make language bindings authors
happier :-)

-- 
Robert Edmonds
edmonds at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-bounds-on-version_string-and-implementation_st.patch
Type: text/x-diff
Size: 1673 bytes
Desc: not available
URL: <http://lists.getdnsapi.net/pipermail/users/attachments/20150710/35ae5b01/attachment.bin>


More information about the Users mailing list