c# - Convert escaped unicode string to bytearray -
my input string consists of mixture of unicode escape characters regular characters mixed in. example:
string input ="\u0000\u0003\u0000\u0013timestamp\u0011clientid\u0015timetolive\u0017destination\u000fheaders\tbody\u0013messageid\u0001\u0006"
how can convert bytearray or stream?
expected output byte[]
// t m e s t m p {0x00, 0x03, 0x00, 0x13, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x11, ...}
this seems work:
encoding.utf8.getbytes(input);
you can try using:
text = bitconverter.tostring(encoding.utf8.getbytes(input));
Comments
Post a Comment