I am writing a webapp with the Go runtime in GAE.
I am saving a struct which contains a string, which is the result of hashing the bytes of another string with MD5, and then encoding the hash sum bytes into a string with hex.
Here is some code:
foo := "some string"
hashedFoo := md5.New()
hashedFoo.Write([]byte(foo))
encodedFoo := hex.EncodeToString(hashedFoo.Sum()) // this is what I'm assigning to my struct, and then saving into the Datastore
This works fine, no complaints when saving or retrieving the stored entities (through code), however, when loading the Datastore Viewer, I get an error that says something like "Error fetching entities: Property Foo is corrupt in the datastore
", and then there is a traceback with a bunch of references to internal GAE files and then this: "UnicodeDecodeError: 'utf8' codec can't decode byte 0x85 in position 1: unexpected code byte
". This does not happen in the local development Datastore Viewer, only in the live production one.
So my questions are: what encoding does hex.EncodeToString()
use? Is there a way to specify utf-8 output? Is this a GAE bug, or is it indeed a bad encoding error?
Thank you in advance.