I have run into such a java String where the following is false:
body.equals(new String(body.getBytes()));
I suppose this is because the String constructor is by default treating the encoding of the body byte[] as UTF-8, I'm not 100% sure. How would I be able to store this string in a byte[] and be able to convert it back later? I suppose I need to be able to determine what encoding the byte[] is in. How would I do this?
Some context: I need the byte[] so I can compress the data, store it in a db, and later uncompress and turn the uncompressed byte[] back into the original string. The string originally comes from some library which downloaded a webpage, and i'm not sure what processing they do on the string before handing it to me.