Skip to content
  • Mikhail Zabaluev's avatar
    gconvert: Correctly annotate string types and output parameters · 8a93e2d5
    Mikhail Zabaluev authored and Philip Withnall's avatar Philip Withnall committed
    Note that the g_convert() API works with byte arrays. It's wrong to
    default to utf8 there, because iconv can read and produce strings with
    interior nul characters which are not allowed in (type utf8).
    The documentation was misleading about that in some places, so that got
    corrected as well.
    
    Strings in the locale encoding are annotated as dynamic-length byte
    arrays because they don't have any guaranteed format and can contain
    nul bytes. For UTF-8 strings in g_*_{from,to}_utf8(), GLib assumes
    no embedded nul bytes and the (type utf8) annotations on the UTF-8
    parameters and return values remain as they were. Likewise for
    (type filename).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756128
    8a93e2d5