If length is not -1, then it must be the number of bytes in TEXT.
The returned string must be freed when no longer required.
*/
If length is not -1, then it must be the number of bytes in TEXT.
The returned string must be freed when no longer required.
*/