Fix for issue #387: xctool randomly crashing during application tests

Handle case where read buffer is terminated in the middle of a UTF-8 multi-byte sequence, leading to failure to convert byte buffer into NSString with UTF-8 encoding and resulting exception.