I'm writing a web application in Google app Engine. It allows people to basically edit html code that gets stored as an .html
file in the blobstore.
I'm using fetchData to return a byte[]
of all the characters in the file. I'm trying to print to an html in order for the user to edit the html code. Everything works great!
Here's my only problem now:
The byte array is having some issues when converting back to a string. Smart quotes and a couple of characters are coming out looking funky. (?'s or japanese symbols etc.) Specifically it's several bytes I'm seeing that have negative values which are causing the problem.
The smart quotes are coming back as -108
and -109
in the byte array. Why is this and how can I decode the negative bytes to show the correct character encoding?
InputStream
and then intobyte[]
. Now when I am trying to convert thebyte[]
into String (I need to use the response body for attacks), I get really funny characters full of smart quotes and question marks and what not. I believe yours problem is same as mine as we both are dealing withhtml
inbyte[]
. Can you please advice? – Parul SString str=new String(buffer, "Cp1252");
but no help. – Parul S