0
votes

After storing blob (byte[]) to Google App Engine datastore, I get a '?' appended to my data after same data fetching from Datastore.

I have an idea, that this has to do with encoding, Since I am not sure what GAE default encoding is, so I tried several Charsets and I get different result, I thought if I share this, I could get more light to the issue.

In my DBHelper class (Util to save and get data), When I initially persisted data with:

Entity resultEntity = new Entity("Entity");
resultEntity.setProperty("HtmlResult", new Blob(str.getBytes()))

I get a '?' appended to the end of my result (data fetched from Local datastore)

After changing my code to below :

resultEntity.setProperty("HtmlResult", new Blob(str.getBytes(Charset.forName("UTF-8"))));

Then I get �� appended to the result.

Also, I think when I used ISO-8859-1, I had � . Sorry for not been sure but I had to deploy to GAE everytime before I can test.

This question is related to Datastore in Hosted GAE- Google app engine appends '?' character during data retrieval but not directly.

Please kindly give your suggestions.

FY: I also tried

<env-variables>
 <env-var name="DEFAULT_ENCODING" value="UTF-8" />
</env-variables> 

Please note that I do not have this problem on my local machine, only when I deploy and test my app on Google app engine.

1

1 Answers