strncat and UTF-8



I'm wondering if there's a recommended GLib idiom for this task: copy at most n bytes from gchar *src to gchar *targ (both in UTF-8), ensuring that the material from src is "properly truncated" if need be. That is, one doesn't finish (before the final NUL) with a byte that fails to complete the UTF-8 representation of some character.

I can sort of see how this might be done (rather painfully) using the GLib Unicode Manipulation API but I wonder if anyone has a snappy implementation -- something like g_utf8_strncat(), if it were to exist.

Allin Cottrell




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