Skip to content

Commit

Permalink
Fixes #4662. LoadError with compiled multi-byte constant.
Browse files Browse the repository at this point in the history
The original code was using String.length() then saving getBytes() but length()
reports characters and not bytes so multi-byte strings were not getting saved
with the correct length.

More commentary in the issue since even with this fix we are still broken in a
known but more fundamental way (and we have since the beginning of time).
enebo committed Jun 12, 2017
1 parent d56b9bb commit f86604a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -150,8 +150,9 @@ public void encode(String value) {
if (value == null) {
encode(NULL_STRING);
} else {
encode(value.length());
buf.put(value.getBytes());
byte[] bytes = value.getBytes();
encode(bytes.length);
buf.put(bytes);
}
}

0 comments on commit f86604a

Please sign in to comment.