Reputation: 1246
When emoji characters are included in text sent to the Google App Engine, they are destroyed. And so is any text following a emoji(s). So any emoji destroys any subsequent text!
The App Engine is implemented in Python, the Endpoints Client Library is generated for Android and the text is saved with Cloud SQL.
Does anyone know about this problem or have a solution for it?
I have updated my app engine to the newest 1.9.9.
The libraries included in the Android app are:
Upvotes: 1
Views: 446
Reputation: 847
I've been working on a similar problem for a while, and I just found a solution. The issue is that App Engine uses "US-ASCII" as the default character set instead of the more useful "UTF-8".
Here are some related resources concerning this problem:
Is there a way to use UTF-8 with app engine?
https://code.google.com/p/googleappengine/issues/detail?id=2219
For me though, I was never able to override the default charset of the JVM through any of the App Engine config settings. Therefore, the only solution that worked for me was explicitly stating the charset whenever you read (or write) data from your endpoints.
If you're using an InputStreamReader, you can do this:
new InputStreamReader(mInputStream, "UTF-8")
Alternatively you can read the data as bytes, and then create a String from the bytes:
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[16384];
while ((nRead = mInputStream.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
}
buffer.flush();
String response = new String(buffer.toByteArray(), "UTF-8");
Hope this helps! I can't believe this has been an App Engine problem since 2009...
Upvotes: 0