I am trying to get a Google App Engine web application to send UTF-8 encoded text to a browser. I do this by writing this:
byte[] utf8Bytes = "æøΓ₯".getBytes("UTF-8");
When I do this locally, I get an array of bytes with 6 bytes. When I do this in the Google App Engine, I get an array with 12 bytes. Strange, huh ??
Does anyone know why?
I managed to write UTF-8 encoded text from GAE, by encoding the bytes themselves, and write the raw bytes. Like this:
output.write(new byte[]{(byte)0xc3, (byte)0xa5, (byte) 0xc3, (byte)0xa6, (byte)0xc3, (byte)0xb8 });
And it really works. But does anyone have an answer to the question why String are encoded differently in GAE than they are locally?
Note. Character encoding using unicode processing like this:
byte[] utf8Bytes = "\u00E5\u00F8\u00E6".getBytes("UTF-8");
source share