Raises error if encoding is not ASCII-compatible.