def ConvertToWireFormat(self, value):
    value = value.encode("utf8")
    return (self.encoded_tag, VarintEncode(len(value)), value)
Internally strings are utf8 encoded.
dataset/ETHPy150Open google/grr/grr/lib/rdfvalues/structs.py/ProtoString.ConvertToWireFormat