Use UTF8 (byte)length instead of character length.

Courtesy of @rrrlasse.

Closes #612 and #604.

@bmunkholm @kneth