QPID-5042: use more portable encode and decode (merged r1511013 from trunk)

git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.24@1511045 13f79535-47bb-0310-9956-ffa450edef68