From 4c6b6814abfc9c022c6ea8d1e23097c2a774fde5 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 28 Aug 2024 12:59:05 +0200 Subject: input and displaying of Unicode characters is now possible (refs #5) * All non-ASCII characters are inserted as Unicode. On Curses, this also requires a properly set up locale. * We still do not need any widechar Curses, as waddch() handles multibyte characters on ncurses. We will see whether there is any Curses variant that strictly requires wadd_wch(). If this will be an exception, we might keep both widechar and non-widechar support. * By convention gsize is used exclusively for byte sizes. Character offsets or lengths use int or long. --- src/string-utils.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/string-utils.h') diff --git a/src/string-utils.h b/src/string-utils.h index 973b954..efc6fc5 100644 --- a/src/string-utils.h +++ b/src/string-utils.h @@ -51,6 +51,12 @@ teco_ascii_toupper(gchar chr) * A target teco_string_t::data is always null-terminated and thus safe to pass * to functions expecting traditional null-terminated C strings if you can * guarantee that it contains no null-character other than the trailing one. + * + * @warning For consistency with C idioms the underlying character type is + * `char`, which might be signed! + * Accessing individual characters may yield signed integers and that sign + * might be preserved when upcasting to a larger signed integer. + * In this case you should always cast to `guchar` first. */ typedef struct { /** -- cgit v1.2.3