[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] Only outputting "valid" characters

From: Ralph Corderoy
Subject: Re: [Nmh-workers] Only outputting "valid" characters
Date: Sat, 12 Jul 2014 13:30:39 +0100

Hi Ken,

> I am unsure if there is a standards-base API that lets us detect
> invalid characters (I'm not interested in something like Recode for
> this).  I wonder if mbtowc() and friends would throw errors if they
> encounter an invalid character in the current locale.

The mbtowc(3posix) here says

    If s is not a null pointer, mbtowc() shall either return 0 (if s
    points to the null byte), or return the number of bytes that
    constitute the converted character (if the next n or fewer bytes
    form a valid character), or return -1 and may set errno to indicate
    the error (if they do not form a valid character).

It goes on to mention EILSEQ.  Does that cover your case?

Cheers, Ralph.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]