This could potentially be simplified with [g_utf8_strup](https://developer.gnome.org/glib/2.36/glib-Unicode-Manipulation.html#g-utf8-strup):

    // This duplicates the string, so you don't need g_strdup
    value = g_utf8_strup (header, -1);