fixed issue with malformed UTF-8 string;

Fixed issue with malformed UTF-8 string
please, move `else if` to the new line for consistency with file style