Add back `ensure 1` to avoid overflowing an output buffer

The counter-example for the existing code is a string of length '2*n' that
starts with 'n' characters with codepoints in the range (0x7F, 0x7FF) and ends
with 'n' ASCII characters. All 'n' ASCII characters will be written after the
end of the output buffer.