Use lower upper bound for pre-allocation in `encodeUtf8`
authorHerbert Valerio Riedel <hvr@gnu.org>
Mon, 28 Aug 2017 11:17:20 +0000 (13:17 +0200)
committerHerbert Valerio Riedel <hvr@gnu.org>
Fri, 29 Sep 2017 21:07:27 +0000 (23:07 +0200)
commitd87a8cf428c36fad40650e15b0eeda234c5e95cc
tree1ae95c45e38ce06eacde2fe5324dcfd8eab63918
parent2d88a0a3e8e3bb79260e5c8f61dd6c447f61c5f5
Use lower upper bound for pre-allocation in `encodeUtf8`

The rationale is that we encode from UTF16 code-units to UTF8, and
to encode a *single* UTF16 code-unit we need at most 3-byte in UTF8.
Wherease 4-byte UTF8 encodings would require surrogate UTF16 pairs.

Fixes #194
Data/Text/Encoding.hs