-
-
Notifications
You must be signed in to change notification settings - Fork 629
decodeWithCharset doesn't flush #2664
Copy link
Copy link
Closed
Labels
Description
In fs2-3.1.3, this test fails:
// Found by scalacheck in old http4s implementation
test("handle overflow") {
if (isJVM) { // Charset not supported by Scala.js
val cs = Charset.forName("x-ISCII91")
val s = Stream(-36.toByte)
.covary[Fallible]
.through(decodeWithCharset(cs))
.compile
.string
assertEquals(s, Right("ी"))
}
}The output buffer is sized to one character based on chunk length and average size queried from the decoder, but the byte expands to two characters. We need to check the [edit: misdiagnosis]CoderResult for an overflow.
This is one of the rare character sets that needs to be flushed after the final input. You can find more here.
Reactions are currently unavailable