Given a proto file:
syntax = "proto3";
package hello;
message TopGreeting {
NestedGreeting greeting = 1;
}
message NestedGreeting {
Greeting g
Answering my own question, I solved this issue by digging through Protobuf source code.
System.out.println(TextFormat.printer().escapingNonAscii(false).printToString(greeting))
Output:
greeting {
greeting {
message: "오늘은 무슨 요일입니까?"
}
}
toString
uses the same mechanism but with escapingNonAscii(true)
(default when omitted).
Also see this answer for how to convert Octal sequences to UTF-8 characters in case you don't have access to the source code, only logs.
The protobuf binary format isn't human readable and you shouldn't attempt to make it so. There is a JSON variant if you need, but frankly it would be better to log the interpreted data, not the payloads.