• Xia Li-yao's avatar
    Fix UTF-8 decoding of lazy bytestrings · 204f6ac2
    Xia Li-yao authored and Bodigrim's avatar Bodigrim committed
    At the beginning of a new chunk we may be trying to complete a UTF-8
    sequence started in the previous chunk (contained in the `undecode0`
    buffer). If it turns out to be invalid, we must apply the `onErr`
    handler to every character in that buffer.
    When we reach the end of the chunk, we must also be more careful
    about when to keep the previous buffer: a UTF-8 sequence (up to 4 bytes)
    can span more than two chunks, when those chunks are very short
    (of length 0, 1, or 2).