protected function encodeString($value, $length = -1) {
        if (-1 !== $length && $length < strlen($value)) {
            throw new TooLongDataException($value, $length);
        }
        return "\"" . substr($value, 0, (-1 === $length ? strlen($value) : $length)) . "\"";
    }