future possible improvement: performance might improve if we pre-allocate buffer (`byte[] utf8`) to encode UTF-8 string.