cutting strings in the middle might result in an invalid UTF8. check for that