Hi,

On Wed, Mar 13, 2019 at 08:35:09PM +0100, Hiltjo Posthuma wrote:
> I don't like mixing of the existing functions with wchar_t.
> I think st should (at the very least internally) use utf-8.

What about having an array of Rune to store worddelimiters and have a
simple search function such as:

Rune *
utf8strchr(Rune *s, Rune u)
{
        for (; *s; s++)
                if (*s == u)
                        return s;
        return NULL;
}

The worddelimiters definition will become:

Rune worddelimiters[] = { ' ', 0 };

Which will allow adding unicode codepoint from wide char literal.
Even if the wchar_t is 16 bits wide the constant will be stored
into a Rune, which I belive is a 32 bits constant, and should work
fine.

my 2cc

Cheers,
Jules


Reply via email to