How do I encode byte[] data?

Jun 23, 2015 at 7: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 7: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 1: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?