[Debburn-devel] Sample mini-iconv (Was: What can I assume about
libc?
Lorenz Minder
lminder at gmx.net
Thu Oct 5 23:43:59 UTC 2006
Hi Peter,
I think with your uniconv functions we can probably away without an
additional, ugly hack involving setlocale() and mbstowcs() just to do
some simple character processing.
For example, to have an equivalent of iswprint() we could do something
like:
int ucs4_isprint(ucs4_t c)
{
#if defined(__STDC_ISO_10646__)
return iswprint((wchar_t)c);
#else
if(c < 256) {
return isprint((int)c);
} else {
/* In this case, we just have to resort to checking the
* legality of the char. */
return is_legal_ucs4(c);
}
#endif
}
That obviously does not give perfect results on all platforms, but is
likely a good enough approximation. So, I'm all for going down that
road!
Best,
--Lorenz
More information about the Debburn-devel
mailing list