Fix crash in utf8ByteArrayToString when opening UTF8 heavy docs

UTF8 allows double-byte chars (as shown in the loop handling behaviour). This means that it's possible for the number of chars to never be exactly 1000. E.g., a double-byte char is added after there are 999 chars. If this happens, the char length will never flush until the function returns, at which point too many arguments are passed into the apply invocation and a maximum stack size error will be thrown.

There is no measurable performance from this change (tested @ 1000pages.odt)

This was discovered with this document: https://drive.google.com/file/d/0B1EH5OPb-RrjTEpqNkVTYV9zZjQ/edit?usp=sharing

(I'm testing various UTF8 documents from https://github.com/bits/UTF-8-Unicode-Test-Documents, converted with LibreOffice and loaded into the editor).