You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The InputStream created using org.jline.utils.PumpReader.createInputStream(Charset) returns EOF (-1) when encountering a supplementary code point (i.e. > U+FFFF) in the input, e.g.:
It appears often encoders try to encode supplementary code points (represented by a surrogate pair consisting of two char) either completely or not at all, so the buffer with size encoder.maxBytesPerChar() is too small, using 2 * encoder.maxBytesPerChar() should solve this issue.
However, even when this is fixed, it would be good to improve the encoding logic by checking for OVERFLOW (instead of silently ignoring it) and throwing an AssertionError here:
The InputStream created using
org.jline.utils.PumpReader.createInputStream(Charset)
returns EOF (-1
) when encountering a supplementary code point (i.e. > U+FFFF) in the input, e.g.:The reason for this is that the buffer is sized incorrectly here:
jline3/terminal/src/main/java/org/jline/utils/PumpReader.java
Line 337 in 620b187
It appears often encoders try to encode supplementary code points (represented by a surrogate pair consisting of two
char
) either completely or not at all, so the buffer with sizeencoder.maxBytesPerChar()
is too small, using2 * encoder.maxBytesPerChar()
should solve this issue.However, even when this is fixed, it would be good to improve the encoding logic by checking for OVERFLOW (instead of silently ignoring it) and throwing an
AssertionError
here:jline3/terminal/src/main/java/org/jline/utils/PumpReader.java
Line 205 in 620b187
The text was updated successfully, but these errors were encountered: