Iconv is just clumsy. You can't even make (sane) wrappers to do this
stuff. It's as if it were designed by people just converting big chunks of
raw text. Maybe it's just me but I'm not seeing that in real world apps.
On the other hand, the iconv API is more flexible the way it is. It can handle strings with embedded zeroes, plus it can deal with strings that are not null terminated. If it assumed the input was zero terminated it could not do either of those things.
The problem is at whichever point in your application where you lose the length data on your strings, there is the problem. Its simply not safe to store a null-terminated buffer in an unknown encoding- it doesnt even make sense to do so. Either convert to a known encoding earlier, or else keep the length data along with the strings's data pointer.
-- Linux-UTF8: i18n of Linux on all levels Archive: http://mail.nl.linux.org/linux-utf8/
