zeromq / clrzmq4

ZeroMQ C# namespace (.NET and mono, Windows, Linux and MacOSX, x86 and amd64)
GNU Lesser General Public License v3.0
241 stars 112 forks source link

Don't encode raw byte array's as strings #33

Closed robertpi closed 9 years ago

robertpi commented 9 years ago

Encoding a byte array, where the byte can be any value, as System.String always seems to lead to corruption of the byte array (ie you don't get the same values out when you try to decode it)

metadings commented 9 years ago

reference: commitcomment-12479353

eieiei... it's about this string strg, NOT about this byte[] bytes....

The method byte[] Z85.ToZ85Decoded(this byte[] bytes) already does what you need:

public static byte[] ToZ85Decoded(this byte[] encoded) 
{
    return Decode(encoded);
}
metadings commented 9 years ago

Well I see there were missing methods byte[] To~Bytes and byte[] En-/DecodeBytes(this string strg... I've made an update now (commit)[https://github.com/zeromq/clrzmq4/commit/24c4eebacafd8d2816c0ea2c66aa806378e5ff06]