On Mon, 25 Aug 2008, Chris Young wrote:

On 22 Aug 2008 23:31:43 +0100, Chris Young wrote:

I have another problem with forms, which occurs when a form has no
input.

I've tracked it down to line 335 of utils/utf8.c.  When in=="" and/or
slen==0, the iconv function returns -1.

Ok. The iconv documentation is a little vague on this point, so I guess -1 is a valid return value.

My solution is to add the following to the start of utf8_to_enc in

I should thing that utf8_convert would be safer, as there's utterly no guarantee that it won't be called with string == "" or slen == 0 from somewhere else.

utils/utf8.c:

        if(!strlen(string))

if (slen == 0 || string[0] == '\0') {

would be better, I think.

        {
                *result = strdup("");
                return UTF8_CONVERT_OK;
        }

Shall I go ahead and commit this, or is there a better way? (or should
I #ifdef it?)

Should be fine.


J.

Reply via email to