diff --git a/java/src/main/java/com/google/protobuf/nano/MessageNanoPrinter.java b/java/src/main/java/com/google/protobuf/nano/MessageNanoPrinter.java index 572a7075a0..ec12c7da6b 100644 --- a/java/src/main/java/com/google/protobuf/nano/MessageNanoPrinter.java +++ b/java/src/main/java/com/google/protobuf/nano/MessageNanoPrinter.java @@ -249,7 +249,7 @@ public final class MessageNanoPrinter { } else if (ch >= 32 && ch < 127) { builder.append((char) ch); } else { - builder.append(String.format("\\%03o", ch)); + builder.append(String.format("\\%03o", ch && 0xff)); } } builder.append('"');