@@ -584,10 +584,26 @@ */ - (size_t)getCString: (char*)cString maxLength: (size_t)maxLength encoding: (of_string_encoding_t)encoding; +/*! + * @brief Writes the OFString into the specified C string with the specified + * encoding, replacing characters that cannot be represented in the + * specified encoding with a question mark. + * + * @param cString The C string to write into + * @param maxLength The maximum number of bytes to write into the C string, + * including the terminating zero + * @param encoding The encoding to use for writing into the C string + * @return The number of bytes written into the C string, without the + * terminating zero + */ +- (size_t)getLossyCString: (char*)cString + maxLength: (size_t)maxLength + encoding: (of_string_encoding_t)encoding; + /*! * @brief Returns the OFString as a C string in the specified encoding. * * The result is valid until the autorelease pool is released. If you want to * use the result outside the scope of the current autorelease pool, you have to @@ -597,10 +613,25 @@ * @return The OFString as a C string in the specified encoding */ - (const char*)cStringWithEncoding: (of_string_encoding_t)encoding OF_RETURNS_INNER_POINTER; +/*! + * @brief Returns the OFString as a C string in the specified encoding, + * replacing characters that cannot be represented in the specified + * encoding with a question mark. + * + * The result is valid until the autorelease pool is released. If you want to + * use the result outside the scope of the current autorelease pool, you have to + * copy it. + * + * @param encoding The encoding for the C string + * @return The OFString as a C string in the specified encoding + */ +- (const char*)lossyCStringWithEncoding: (of_string_encoding_t)encoding + OF_RETURNS_INNER_POINTER; + /*! * @brief Returns the OFString as a UTF-8 encoded C string. * * The result is valid until the autorelease pool is released. If you want to * use the result outside the scope of the current autorelease pool, you have to