This repository has been archived by the owner on Oct 17, 2020. It is now read-only.
Fix for characters >= 128. #283
Comments
The current protocol does not use characters above 128, but we've got plans to implement it as an extension, with a more useful charset (Win-1252 derivative, rather than CP437). |
Fair enough. But this is more of a fix for reading all characters above 127, so it would still be useful for that future extension. |
Don't worry, the whole font renderer and chat subsystem is to be rewritten cleanly. |
Yes, a rewrite would definitely be nice. Slightly off topic, but this should fix the issue of an emote at the end of a message being hidden. int length = 64;
for (int i = 63; i >= 0; i--) {
if (chars[i] == 0 || chars[i] == 32) {
length--;
} else {
length = i + 1;
break;
}
}
return new String(chars).substring(0, length); |
Now that's definitely worth fixing for everyone. Thanks! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When trying to render characters with values >= 128, the client crashes with (for example) 'IndexOutOfBoundsException: 65531'.
This is (almost certainly) because Java is treating them as signed bytes and casting them to unsigned chars.
By changing NetHandler.readObject() from
to
I was able to fix the problem. (no changes were necessary for rendering)
The text was updated successfully, but these errors were encountered: