It already returns an empty string if it encounters an invalid character. However, if, instead, it has an incomplete set of characters, it currently returns a truncated result. Instead, it detects truncation and returns the empty string.