Fix size calculation for UTF-8 strings

Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>