This project has moved and is read-only. For the latest updates, please go here.

How do I encode byte[] data?

Jun 23, 2015 at 8:14 AM
I have a byte[] data, when I use

It can not change to string well,
because byte[] has some byte are "0xff".

so how can I do?
If I need to encode byte[] data.
Jun 23, 2015 at 8:33 AM
String ori_str = "01LH0100100ZA001JL";

through my code, output hex
public static void hex_output(byte[] msg, int nbytes)
            int i;
            for (i = 0; i < nbytes; i++)
                Console.Write("{0:x2}", msg[i]);
will get : ( I add "_" in here)

this output change to string, then change back byte[]
string s = System.Text.Encoding.Default.GetString(msg, 0, nbytes);
byte[] new_msg = System.Text.Encoding.Default.GetBytes(s);
will get : ( I add "_" in here)

It's I need to use byte[], not string.
Jun 24, 2015 at 2:46 AM
For example:
byte[] data = new byte[]{0xff, 0x00, 0xff, 0x00, 0xff};

if using this byte[] array, how can I encode to QR_CODE?