Convert unsigned char * to Glib::ustring

Please, advice optimal method to make that with native glibmm API?

Can I use Glib::ustring(subject) for char * subject
but can’t with unsigned char * subject one (returned by sqlite3_column_text)

I’m worried to use reinterpret_cast<const char*>(subject) or C-like (char*) as could be unsafe. Maybe some build-in, string-oriented solution already provided by Glib?

According to C/C++ Interface For SQLite Version 3 sqlite3_column_text returns NULL-terminated UTF-8 so considering how UTF-8 uses the “sign” bit, reinterpret casting to const char* for creating a Glib::ustring should be safe

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.