> strncpy() works fine for C strings that represent text in whatever
> multi-byte codeset (as long as it lacks zero bytes), like UTF-8,
> Microsoft's double-byte codepages, etc.
> (Well, I exaggerate, obviously if you want to be sure that multi-byte
> characters don't get truncated you shouldn't use strncpy(), but some
> encoding-aware function.)

That encoding-aware function would be g_utf8_strlcpy.
See http://bugzilla.gnome.org/show_bug.cgi?id=520116
This was entered by Behdad some time back. I have recently attached a proposed implementation. Maybe it can be committed.

Philip Page
The best laid schemes o' mice an' men gang aft aglay. -Burns

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